Re: Tkinter checkbuttons and variables

2007-02-21 Thread Eric Brunel
On Wed, 21 Feb 2007 15:50:57 +0100, Gigs_ <[EMAIL PROTECTED]> wrote: > 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(

Re: Tkinter checkbuttons and variables

2007-02-21 Thread Diez B. Roggisch
Gigs_ schrieb: > 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() > pri

Tkinter checkbuttons and variables

2007-02-21 Thread Gigs_
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 everythin