Thanks for the replies for my earlier question. I should have stated my
question in a better way.
My question is related to SCOPE!
For example:
#====================================
from Tkinter import *
#-------------------------------------------------
def doIt():
print x
#------------------------------------------------
root=Tk()
btn=Button(root,text="DO",bg="cyan",command=doIt)
btn.pack(side=BOTTOM)
x=11
#NOTE that it works even when the mainloop() method below is commented
out!!!!
#root.mainloop()
#===================================================================
so: if
(1) there is no mainloop()
(2) x=11 is declared in the MAIN part
(3) command=doIt() has no argument
(4) doIt() fn appears ahead of the x=11 statement
My Question is: why x=11 is within the scope of the doIt() callback fn?
--
View this message in context:
http://old.nabble.com/Button-command-callback-question----Part-2-tp32082790p32082790.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss