title: Tkinter window configuring python error "of no return"
body: <p>OK so I have this long program. I'm having a problem with the themes. By themes I mean, a specific function I built to change the background and text color when activated in Tkinter.
  Here's a shortened version of the code:</p>
  
  <pre><code> global theme
   theme = 0
   windows = []
   buttons = []
   labels = []
  messageboxes = []
  </code></pre>
  
  <h1>Code...</h1>
  
  <pre><code>    def flavor_0():
      global theme
      for w in windows:
          w.config(bg = 'black')
      for l in labels:
          l.config(bg = 'black', fg = 'white')
      for b in buttons:
          b.config(activebackground = "grey", activeforeground = "white", bg = 'black', fg = 'white')
      for i in listboxes:
          i.config(bg = 'black', fg = 'white', relief = "ridge") 
      theme = 0
  </code></pre>
  
  <h1>More Code... ( I define the other flavors in this section)</h1>
  
  <pre><code>def set_theme():
      global theme
      global register
      if theme == 0:
          flavor_0()
      elif theme == 1:
          flavor_1()
      elif theme == 2:
          flavor_2()
      elif theme == 3:
          flavor_3()
      elif theme == 4:
          flavor_4()
  </code></pre>
  
  <h1>Even More Code</h1>
  
  <pre><code>    thememenu = Tkinter.Menu(menubar,tearoff = 0)
      thememenu.add_command(label="Plain",command = flavor_0)
      thememenu.add_command(label="Mint", command = flavor_1)
      thememenu.add_command(label="Strawberry", command = flavor_2)
      thememenu.add_command(label="Banana", command = flavor_3)
      thememenu.add_command(label="Peanut", command = flavor_4)
      menubar.add_cascade(label="Flavor", menu = thememenu)
  
      def windowinator():
          new = Tkinter.Tk()
          windows.append(new)
          set_theme()
  
      windowinator = Tkinter.Button(root,text="New Window", command = windowinator)
      windowinator.pack()
      buttons.append(windowinator)
  </code></pre>
  
  <p>OK finally done.
  Now when I run this the theme changer works. Until I use "windowinator". As long as a window I have opened before is not closed, the theme can be changed without any problems. But when I do close just one of them and attempt to change the "theme": I get a plain (themeless window) and this awkward error :</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
      return self.func(*args)
    File "C:\Users\Ahmet\Desktop\Fobby\FOBBY.py", line 70, in flavor_3
      w.config(bg = 'black')
    File "C:\Python27\lib\lib-tk\Tkinter.py", line 1202, in configure
      return self._configure('configure', cnf, kw)
    File "C:\Python27\lib\lib-tk\Tkinter.py", line 1193, in _configure
      self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
  TclError: invalid command name "."
  </code></pre>
  
  <p>So can anyone tell me what went wrong exactly?</p>