title: Why am I getting this error when trying to get text from an entry object: Tkinter AttributeError: CustomClass instance has no attribute 'entry'?
body: <p>I am new to Tkinter and I have already troubleshot by simplifying my class, and also reading this other question on stack: <a href="https://stackoverflow.com/questions/10727131/why-is-tkinter-entrys-get-function-returning-nothing">&quot;Why is Tkinter Entry's get function returning nothing?&quot;</a> and neither have helped.</p>
  <p>I want to call a function that uses the <code>entry.get()</code> method to print the user input to the console.</p>
  <pre><code>from tkinter import *
  
  class UserInterface:
      def __init__(self, master):
          lbl1 = Label(root, text=&quot;Enter graph size:&quot;)
          lbl1.grid(row=1, sticky=E)
  
          entry1 = Entry(root)
          entry1.grid(row=1, column=5)
          
          printButton = Button(root, text=&quot;Print&quot;)
          printButton.bind(&quot;&lt;Button-1&gt;&quot;, self.printSize)
          printButton.grid(row=2,column=10)
  
        
      def printSize(self, event):
          print(&quot;Testing: &quot; + self.entry1.get())
  
  root = Tk()
  c = UserInterface(root)
  root.geometry('500x500')
  root.title('Tkinter Testing')
  root.mainloop()
  </code></pre>
  <p>Here's the full exception thrown:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py&quot;, line 1547, in __call__
      return self.func(*args)
    File &quot;testing.py&quot;, line 21, in printSize
      print(&quot;Testing: &quot; + self.entry1.get())
  AttributeError: UserInterface instance has no attribute 'entry1'
  </code></pre>