On 7/14/2010 9:33 AM Corey Richardson said...
Hmm..If I add a few debugging lines like that into my code, I get this:
The point was that statements in a class at class level (ie, not in
defs) are executed sequentially and expect referenced variables to exist
(ie, defined somewhere 'above' the current statement) -- there is no
forward peeking going on. Statements within def's (think 'deferred
execution' if it helps) expect that the variables referred to will exist
by the time the def is invoked.
Python executes code top to bottom. def's create an executable object
and defers execution until invoked. Other statements execute when
encountered. The statements in your class that start
top = tk.Tk()
thru...
F.mainloop()
execute in top-down sequence as they are outside of def's. That's your
problem. It's unusual to have that done within a class definition and I
expect it shouldn't be there.
HTH,
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor