title: Tkinter Canvas Freezes Program
body: <p>For my class, I am creating a "Mandelbrot Explorer" program. There is one main issue: I lose control of the GUI (all written in Tkinter/Ttk, in Python 2.7) when actually drawing to the Canvas.</p>
  
  <p>Here is my code:</p>
  
  <pre><code># There is some code above and below, but only this is relevant
  
  for real, imag in graph.PlaneIteration(self.graph.xMin, self.graph.xMax, resolution, self.graph.yMin, self.graph.yMax, resolution, master = self.graph, buffer_action = self.graph.flush):
      # the above line iterates on the complex plane, updating the Canvas for every x value
      c = complex(real, imag)
      function, draw, z, current_iter = lambda z: z**2 + c, True, 0, 1
      while current_iter &lt;= iterations:
          z = function(z)
          if abs(z) &gt; limit:
              draw = False
              break
          current_iter += 1
      self.progressbar.setValue(100 * (real + self.graph.xMax) / total)
      color = self.scheme(c, current_iter, iterations, draw)
      # returns a hex color value
      self.graph.plot(c, color)
      # self.graph is an instance of my custom class (ComplexGraph) which is a wrapper
      # around the Canvas widget
      # self.graph.plot just creates a line on the Canvas: 
      # self.create_line(xs,ys,xs+1,ys+1, fill=color)
  </code></pre>
  
  <p>My issue is that when run, the graphing takes a while - about 30 seconds. In this time, I cannot use the GUI. If I try to, the window freezes and only unfreezes once the drawing is done.</p>
  
  <p>I tried using threading (I enclosed the entirety of the upper code in a function, <code>thread_process</code>):</p>
  
  <pre><code>thread.start_new_thread(thread_process, ())
  </code></pre>
  
  <p>However, the problem remains.</p>
  
  <p>Is there a way to fix this? Thanks!</p>