Save check box states : CheckBox « GUI Tk « Python






Save check box states

Save check box states


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                          


           
       








Related examples in the same category

1.Check Button Demo: disabledCheck Button Demo: disabled
2.Get check box statesGet check box states
3.A check box buttonA check box button
4.Add a check box to a DialogAdd a check box to a Dialog
5.Check box bar: get selected check boxCheck box bar: get selected check box
6.Border for a group of check boxesBorder for a group of check boxes