I am new to tkinter & am having trouble with checkButton(). I want it so that when I check "Button 3", "Button 1" & "Button 2" will be checked also. This is my code so far. I looked at this question: Can i make one checkbutton in tkinter check all the other checkbuttons?, which led me to use the .select() method, but when I run the GUI & check button 3, button 1 & 2 do not get checked. How should I write the function so that when I check "Button 3", "Button 1" & "Button 2" are checked also?
from tkinter import *
root = Tk()
button1_bool = BooleanVar()
button1 = checkButton(root, text = "Button 1", variable = button1_bool, onvalue = True, offvalue = False)
button1.pack()
button2_bool = BooleanVar()
button2 = checkButton(root, text = "Button 2", variable = button2_bool, onvalue = True, offvalue = False)
button2.pack()
def button3ischecked():
if button3.get() == True:
button1.select()
button2.select()
button3_bool = BooleanVar()
button3 = checkButton(root, text = "Button 3", variable = button3_bool, onvalue = True, offvalue = False, command = button3ischecked)
root.mainloop()
button3and you need to useButton3_bool.get()