title: Python object instance missing attribute?
body: <p>I am trying to use TKinker but also trying to understand object orientated programming. I keep getting the same error,</p>
  
  <blockquote>
    <p>File "C:/Users/User/Documents/Python Scripts/tK_Slider.py", line 28,
    in getAngle
        print self.scale1.get() AttributeError: App instance has no attribute 'scale1'</p>
  </blockquote>
  
  <p>My code,</p>
  
  <pre><code>from Tkinter import *
  
  class App:
  
      def __init__(self, master):
  
          frame = Frame(master)
          frame.pack()
  
          self.scale1 = Scale(master, from_=0, to=180, command=self.getAngle(1))
          self.scale1.pack(side=LEFT)
          self.scale2 = Scale(master, from_=0, to=180, command=self.getAngle(2))
          self.scale2.pack(side=LEFT)
          self.scale3 = Scale(master, from_=0, to=180, command=self.getAngle(3))
          self.scale3.pack(side=LEFT)
          self.scale4 = Scale(master, from_=0, to=180, command=self.getAngle(4))
          self.scale4.pack(side=LEFT)
  
      def getAngle(self, slider):
          if slider==1:
              print self.scale1.get()
          if slider==2:
              print self.scale2.get()            
          if slider==3:
              print self.scale3.get()
          if slider==4:
              print self.scale4.get()
  
  root = Tk()
  app = App(root)
  root.mainloop()
  </code></pre>
  
  <p>What am I misunderstanding here?</p>
  
  <p>I thought that I had created the attribute <em>scale1</em> before I tried to query its value, so why isnt it carried over into <em>getAngle()</em>?</p>