title: Tkinter: AttributeError: NoneType object has no attribute <attribute name>
body: <p>I've created this simple GUI:</p>
  
  <pre><code>from tkinter import *
  
  root = Tk()
  
  def grabText(event):
      print(entryBox.get())    
  
  entryBox = Entry(root, width=60).grid(row=2, column=1, sticky=W)
  
  grabBtn = Button(root, text="Grab")
  grabBtn.grid(row=8, column=1)
  grabBtn.bind('&lt;Button-1&gt;', grabText)
  
  root.mainloop()
  </code></pre>
  
  <p>I get the UI up and running. When I click on the <code>Grab</code> button, I get the following error on the console:</p>
  
  <pre><code>C:\Python&gt; python.exe myFiles\testBed.py
  Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Python\lib\lib-tk\Tkinter.py", line 1403, in __call__
      return self.func(*args)
    File "myFiles\testBed.py", line 10, in grabText
      if entryBox.get().strip()=="":
  AttributeError: 'NoneType' object has no attribute 'get'
  </code></pre>
  
  <p>Why is <code>entryBox</code> set to <code>None</code>?</p>