Tkinter checkbuttons and variables
Gigs_
gigs at hi.t-com.hr
Wed Feb 21 09:50:57 EST 2007
More information about the Python-list mailing list
Wed Feb 21 09:50:57 EST 2007
- Previous message (by thread): Replacement for GnomeDateEdit?
- Next message (by thread): Tkinter checkbuttons and variables
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
from Tkinter import *
states = []
def onpress(i):
states[i] = not states[i]
root = Tk()
for i in range(10):
chk = Checkbutton(root, text= str(i), command=lambda i=i:
onpress(i))
chk.pack(side=LEFT)
states.append(0)
root.mainloop()
print states
after exiting i get everything like it suppose to but when i put command
like this:
command=lambda: onpress(i)
i got only last checkbutton check.
Why i have to pass this default argument?
btw i have python 2.5
thx
- Previous message (by thread): Replacement for GnomeDateEdit?
- Next message (by thread): Tkinter checkbuttons and variables
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list