title: Tkinter Matplotlib, backend conflict?
body: <p>I'm quite new to python but I've spent my last week trying to code a software to visualize some weavy thingy.</p>
  
  <p>The basic cinematic is: the user enters every information needed into a GUI then click proceed and I have an other big function to genereate all the graphics.</p>
  
  <p>This was working but the problem was that when I ran the function, which lasts like 2 minutes, the tkinter window was freezing. I read that I should use threads.
  Then I found this: <a href="http://uucode.com/texts/pylongopgui/pyguiapp.html" rel="nofollow">http://uucode.com/texts/pylongopgui/pyguiapp.html</a>
  This is an example that basicaly does what I want plus some other things.</p>
  
  <p>I'm now trying to adapt my code to make it fit this.</p>
  
  <p>And here is my problem: everything seems to work fine except that at one moment in my function a new window called "tk" pop up and everything freeze.</p>
  
  <p>Everything freeze at this moment: </p>
  
  <pre><code># On trace les fils de chaine
  for i in range(0, Couches_Trame + 1):
      t = np.arange(0, np.pi, 0.1)
      plt.figure(i)
      plt.title('Plan de Trame ' + str(i+1), fontsize = '16')
      ax = plt.gca()
      ax.yaxis.set_visible(False)
      ax.xaxis.set_visible(False)
      plt.axis([-1, Plans, Fils_Chaine + 1, -1])
      for j in range(0,Plans):
          for k in range(0,Fils_Chaine):
              plt.fill_between(np.cos(t)/8+j, np.sin(t+np.pi)/8+k+0.5, \
              np.sin(t)/8+k+0.5, color='r')
      plt.savefig('Blabla'+int(i))
  plt.figure(Couches_Trame)
  plt.title('Plan de Trame: Projection')
  </code></pre>
  
  <p>When I run it directly without using Tkinter everything works fine so I have no idea what's causing this.</p>
  
  <p>Also I've tried replacing this piece of code by and infinite loop like this:</p>
  
  <pre><code>i=1
  while i &gt; 0:
      i=i+1
      print(i)
  </code></pre>
  
  <p>This works and nothing is freezing. But then I tried this:</p>
  
  <pre><code>i=1
  while i &gt; 0:
      i=i+1
      plt.plot((i,i))
  </code></pre>
  
  <p>And everything freezes and the window called "tk" pop-up and instantly freezes.</p>
  
  <p>I read somewhere that this could be a conflict beetwen Tkinter and matplotlib backend but that's all and this didn't help me much.</p>
  
  <p>Edit: I don't know if this help but I'm using Python Portble 2.7.2.1</p>