title: Python Tkinter [ can't invoke command: application has been destroyed ]
body: <p>I'm creating two functions on Python :</p>
  
  <ul>
  <li>one to open a new window : new_window()</li>
  <li>another one to create a button on it : create_buttons('text displayed')</li>
  </ul>
  
  <p>When I launch them, new_window works well but create_button displays [can't invoke "button" command: application has been destroyed] as if my master window had been destroyed... But my window is still open !</p>
  
  <p>... Do you have any idea ??</p>
  
  <pre><code>import Tkinter
  
  from Tkinter import *
  
  def new_window():
  
     master = Tk()
  
  def create_buttons(display):
  
     new_button= Button(master, text=display)
  
     new_button.pack()
  
  new_window() ### OK, CREATES A WINDOW
  
  create_buttons('text') ### DISPLAYS FOLLOWING BUG :
  
  create_buttons('text')
  
  TclError                                  Traceback (most recent call last)
  
  /neurospin/grip/protocols/MRI/childrenDTIreading_Letarnec_2011/tools/data_mysql/&lt;ipython console&gt; in &lt;module&gt;()
  
  /neurospin/grip/protocols/MRI/childrenDTIreading_Letarnec_2011/tools/data_mysql/&lt;ipython console&gt; in create_buttons(display)
  
  /usr/lib/python2.6/lib-tk/Tkinter.pyc in __init__(self, master, cnf, **kw)
     2003             overrelief, state, width
     2004         """
  -&gt; 2005         Widget.__init__(self, master, 'button', cnf, kw)
     2006 
     2007     def tkButtonEnter(self, *dummy):
  
  /usr/lib/python2.6/lib-tk/Tkinter.pyc in __init__(self, master, widgetName, cnf, kw, extra)
     1933                 del cnf[k]
     1934         self.tk.call(
  -&gt; 1935             (widgetName, self._w) + extra + self._options(cnf))
     1936         for k, v in classes:
     1937             k.configure(self, v)
  
  TclError: can't invoke "button" command:  application has been destroyed
  </code></pre>