Reputation: 183
I am writing a program which reads data form a file, and adjust the settings accordingly. This is how I created the checkbutton:
should_auto = BooleanVar()
autodetect = Checkbutton(root, text="Autodetect", var=should_auto, onvalue = True, offvalue = False, command=toggle_delay)
autodetect.grid(row=0, column=2, padx=7, pady=5, sticky=W)
I then try to "check" it using:
autodetect.select()
but this returns following error:
Traceback (most recent call last):
File "C:\Users\CedBook\Documents\GitHub\live-image-desktop-background\src\GUI.py", line 110, in <module>
autodetect.select()
AttributeError: 'Checkbutton' object has no attribute 'select'
I have already also tried using autodetect.set(True)
, but then i get almost the same error, but Checkbutton object has no attribute 'set'
I saw .select() on effbot.org, but maybe that is not for python 3?
Upvotes: 4
Views: 8917
Reputation: 7367
Can you set the value of the boolean instead?
should_auto.set(True)
should update the checkbox that relies on it.
Upvotes: 1