With Checkbuttons, it is also possible to use other variable types:
var = tk.StringVar() var.set("OFF") checkbutton_active = tk.Checkbutton(master, text="Active?", variable=self.var, onvalue="ON", offvalue="OFF", command=update_value)
The only restriction is to match onvalue and offvalue with the type of the Tkinter variable; in this case, since "ON" and "OFF" are strings, the variable should be a StringVar. Otherwise, the Tcl interpreter will raise an error when trying to set the corresponding value of a different type.