On Monday, January 13, 2014 12:49:07 PM UTC-6, Lewis Wood wrote:
> labelent1 = Label(main, text="Correct!",fg="green").grid(row = 0, column = 3)
> 
> [snip]
> 
> UnboundLocalError: local variable 'labelent1' referenced before assignment

Observe the following interactive session and prepare to be enlightened.

## INCORRECT ##
py> from Tkinter import *
py> root = Tk()
py> label = Label(root, text="Blah").pack()
py> type(label)
<type 'NoneType'>

## CORRECT ##
py> label = Label(root, text="Blah")
py> label.pack()
py> label
<Tkinter.Label instance at 0x027C69B8>
py> type(label)
<type 'instance'>

## ANY QUESTIONS? ##
py> help()
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to