title: AttributeError: '_tkinter.tkapp' object has no attribute 'titleBar'
body: <p>I have written an GUI with tkinter. In the background I have to perfom some intensive calculations. From time to time I want to write some information from the calculation thread to the GUI window.</p>
  
  <p>First I thought it was a good idea to add the computation code into the "mainloop". But this doesn't work, because the mainloop is resposible for keeping the GUI reactive. It seams to be no good idea to mainpulate it.</p>
  
  <p>Below I have created a dummy app that scatches my new idea. The Sample app has a container. Inside that container, there is a TitleBar. The class TitleBar is defined below. It contains only one label.</p>
  
  <p>Next I define a simple thread. It simulates a timeconsuming computation that wants to write some information to the GUI.</p>
  
  <pre><code>import tkinter as tk
  import threading
  import time
  
  
  class SampleApp(tk.Tk):
      def __init__(self, *args, **kwargs):
          # initialize the main window
          tk.Tk.__init__(self, *args, **kwargs)
  
          # add a container which will take all the widgets
          container = tk.Frame(self, bg="green")
          container.pack(side="top", fill="both", expand=True)
  
          # Add a titlebar object (defined below)
          titleBar = TitleBar(container, controller=self) 
          titleBar.grid(row=0, column=0, columnspan=2, sticky=tk.N+tk.W+tk.E)
  
  
  class TitleBar(tk.Frame):
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          self.controller = controller
  
          # the title bar contains only one label element
          titleLabel = tk.Label(self, text="This is the initial text")
          titleLabel.pack(side=tk.LEFT)
  
  
  # Define a thread that runs in the background to perform intensive calculations
  class MyTestThread(threading.Thread):
      def run(self):
          for i in range(10):
              time.sleep(1)
              a = i+100        # intensive calculation
  
              # from time to time: inform use about status
              print(a)      # printing to console works fine
              app.titleBar.titleLabel['text'] = "test 1"   # --- FAILS ---
  
  
  if __name__ == "__main__":
      app = SampleApp()
  
      app.titleBar.titleLabel['text'] = "test 2"   # --- FAILS ---
  
      t = MyTestThread()
      t.start()
  
      app.mainloop()
  </code></pre>
  
  <p>The problem is that I cannot access the label to write information to it. The writing fails, both, from within the thread and from the app itself. In both cases it fails with the following error:</p>
  
  <pre><code>AttributeError: '_tkinter.tkapp' object has no attribute 'titleBar'
  </code></pre>
  
  <p>How can I access and change the properties of the label-object?</p>
  
  <p>Thank you</p>
  
  <p>Bernd</p>