gert wrote:
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=0
def weegbrug():
    global x
    while True:
        x=x+1
        sleep(0.5)
start_new_thread(weegbrug,())

def display():
    v.set(x)
    root.after(500, lambda:display())
1) Note that x, v, and root are read and manipulated, but not written.
   So, they do not need to be declared global (global is only needed
   to declare writable global names).
2) The last statement could more easily be written:
   root.after(500, display)
...
root.after(500, lambda:display())
Again you can write this:
   root.after(500, display)

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to