title: Change the display text in a Tkinter label widget based on a condition
body: <p>The code below is what I'm referencing
      from tkinter import *</p>
  
  <pre><code>root = Tk()
  
  #Variables
  answer = "Enter Answer"
  
  data = ""
  
  #Functions
  def function():
      data = e.get()
      while data == "":
          if data == 5:
              answer = "Correct"
          if data != 5:
              answer = "Incorrect"
      print(answer)
  
  
  top = Label(root, text = "Test")
  top.pack()
  
  e = Entry(root)
  e.pack()
  e.focus_set()
  
  b = Button(root, text = "Enter", command = function)
  b.pack()
  
  check = Label(root, text = answer)
  check.pack()
  
  mainloop()
  </code></pre>
  
  <p>I can't seem to update the label widget (name 'check').
  I want to be able to update it based checking a condition, but I can't get it to work.
  I placed the 'print(answer)' line to check the variable, but I get the error:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
      return self.func(*args)
    File "G:/Portable Apps/Portable Python 3.2.5.1/Documents/TEST.py", line 22, in function
      print(answer)
  UnboundLocalError: local variable 'answer' referenced before assignment
  </code></pre>
  
  <p>This occurs when I run the program, type a value, then select the enter button.</p>