I am trying to create checkbox with default value True
,but it's not working, I tried plenty of the answers but didn't work
import tkinter as tk
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title("Test v1")
self.geometry("400x250")
self.build_init()
def build_init(self):
#CheckVar = tk.BooleanVar(self,)
CheckVar = tk.IntVar(value=1)
checkbutton = tk.Checkbutton(self, text = "Test", variable = CheckVar,onvalue=1, offvalue=0)
#checkbutton.select()
checkbutton.place(x=20,y=80)
App().mainloop()
I coouln't find much on it in the documentaion other than select
which didn't work, Also on this question Tkinter: is there a way to check checkboxes by default?