title: Calling Tkinter class from another class (Python on Raspberry Pi)
body: <p>I am stumped as to why the Display class isn't running in the following code. I call it using Display(root) in main(). The main class runs just fine. I don't get any errors in terminal.</p>
  
  <pre><code>#!/usr/bin/python
  
  import alsaaudio as aa
  import audioop
  import Tkinter as tk
  import tkFont
  
  
  class Display():
  
      def __init__(self, parent):
          self.parent = parent
  
          self._geom = '200x200+0+0'
          parent.geometry("{0}x{1}+0+0".format(parent.winfo_screenwidth(), parent.winfo_screenheight()))
          parent.overrideredirect(1)
  
          parent.title('Listen')
          parent.configure(background='#000000')
          parent.displayFont = tkFont.Font(family="Unit-Bold", size=150)
  
      def printMessage(self, parent, messageString):
          self.message = tk.Message(self.parent, text=messageString, bg="#000000", font=parent.displayFont, fg="#777777", justify="c")
          self.message.place(relx=.5, rely=.5, anchor="c")
  
  def main():
  
      root = tk.Tk()
      window = Display(root)
  
      # Set up audio
      data_in = aa.PCM(aa.PCM_CAPTURE, aa.PCM_NONBLOCK, 'hw:1')
      data_in.setchannels(2)
      data_in.setrate(44100)
      data_in.setformat(aa.PCM_FORMAT_S16_LE)
  
      data_in.setperiodsize(256)
  
      while True:
         # Read data from device
         l,data = data_in.read()
         if l:
            # catch frame error
            try:
               max_vol=audioop.rms(data,2)
               scaled_vol = max_vol//4680      
               print scaled_vol
  
               window.printMessage(root, scaled_vol)
  
            except audioop.error, e:
               if e.message !="not a whole number of frames":
                  raise e
  
      root.mainloop()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Also, both classes run perfectly separately. I'm just having problems using them together.</p>