Click here to Skip to main content
15,883,949 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a check button in my program. when I click the check button, the var value is always 0. Shouldn't the value be 1 when clicked. It works in a small program that i made but when I try to get a check button value in my big program, the value is always 0 no matter how many times I click the checkbutton.

What I have tried:

I have tried a sample program to get the var value of the check button but when I try to do the same thing in my bigger program, the var value is always 0
Posted
Updated 13-May-20 20:29pm
v2

Use this syntax for checkbutton


var = IntVar()<br />
button = Checkbutton(root, text = "Text", variable =var,onvalue=1,offvalue=0)

Hope it helps😊
 
Share this answer
 
You need to show the actual code that you are using. In the meantime take a look at The Tkinter Checkbutton Widget[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900