Threading and tkinter

Hendrik van Rooyen mail at
Fri Feb 20 08:42:16 CET 2009

 "gert" <ger...ns at>

> Hope you do not mind ignoring part of answers, so I can figure out
> more why things work the way they are.
> This two examples work, what i do not understand is that in function
> display i do not have to declare root, v or x ?

x is easy - it was declared outside, in module scope, and you 
modified it after declaring it global.

The others are more subtle, and have to do with how the interpreter
searches for stuff  - first in the local scope, then up the stack in
the callers scope, up to finally in the module global scope.

That also explains why, if it is not found, you get an error message that
says "Global variable xxxxx not defined" (try it and see)

- Hendrik

More information about the Python-list mailing list