[Tkinter-discuss] A Button command callback question...

GKalman kalman_g at msn.com
Mon Jul 18 05:34:58 CEST 2011


The following code fragment works OK.  Question: why?
#======================================
from Tkinter import *
root=Tk()

lbl=Label(root,text='1').pack()

def doIt():
    lbl.config(bg="yellow")

btn=Button(root,text="do", bg="cyan",command=doIt).pack()

root.mainloop()
#=======================================
My question is: how is the instance lbl.config(...) recognized in the doIt
callback fn when called from the main w/o an argument referencing lbl?


-- 
View this message in context: http://old.nabble.com/A-Button-command-callback-question...-tp32080554p32080554.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list