uncheck checkbox tkinter after a certain time interval

Question:

my program is based on independent checkboxes, that is, they do not depend on a booleanVar, I am using a setInterval created from a thread , and after a certain time I want the checkbox to ‘turn off’ and be able to receive another setInterval

self.timer = Checkbutton(command=session_timer ,text='Session Timer')
self.timer.grid(row=1,column=1, sticky='w')

currently my solution is to recreate the checkbox itself again in the same position as the previous one inside my timer function

if timer >= timer_interval_minutes:
    self.timer = Checkbutton(command=session_timer ,text='Session Timer')
    self.timer.grid(row=1,column=1, sticky='w')

however what I’m looking for is something to simply disable and change the text, something like this

if timer >= timer_interval_minutes:
    self.timer.configure(state='normal')

however the ‘state’ function only has 3 options, ‘active’, ‘disabled’, ‘normal’, none of them can only disable the checkbox

checkbox uncheck using configure, or something similar

Asked By: PyCHero

||

Answers:

The checkbutton has a documented method named deselect which does what the name implies.

if timer >= timer_interval_minutes:
    self.timer.deselect()
Answered By: Bryan Oakley
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.