How can I check a checkbox in Python's Tkinter grid

时间:2016-04-04 17:15:17

标签: python-2.7 user-interface checkbox tkinter

I have a checkbox on a GUI, using the following script:

# Define checkbox
CheckVar1 = IntVar()
C1 = Checkbutton(tab2, text = "NW", variable = CheckVar1, onvalue = 1, offvalue = 0)

# Place checkbox on GUI
C1.grid(column=0, row=4)

What command can I use to check the box, if a certain condition is met?

1 个答案:

答案 0 :(得分:1)

Call the set method of the associated varible:

CheckVar1.set(1)