The checkbutton does not change after put a tick in tkinter

        self.var1 = tk.BooleanVar()
        self.var1.set(False)
        print(self.var1.get())
        self.ck_breakfast = tk.Checkbutton(self.reserve_win,text='Breakfast',variable=self.var1,font=('Helvetica',20),command=self.change_tick)
        self.ck_breakfast.grid(row=0,columnspan=2,padx=10,pady=3)

def change_tick(self):
        print(self.var1.get())

In this program, I am not able to change self.var1.get() into True after I put a tick on the checkbutton. I also tried to initialize it as False but after putting a tick it still remains the value as False. May I ask is there any methods to change it to True after a tick put on the checkbutton?



Read more here: https://stackoverflow.com/questions/64940064/the-checkbutton-does-not-change-after-put-a-tick-in-tkinter

Content Attribution

This content was originally published by Dom807 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: