I was trying to have a checkbox which switches the value of a variable when clicked on(w/tkinter):
import tkinter as tk
CheckVar1 = tk.IntVar()
isOn = False
C1 = tk.Checkbutton(window, text = "Decreasing", variable = CheckVar1, onvalue=1, offvalue=0, height=5)
C1.place(relx=0.05, rely=0.3)
C1.bind("<<CheckboxSelect>>",lambda _: isOn = True if isOn == False else False)
print(isOn)
But I'm having trouble with lambda:
lambda _: isOn = True if isOn == False else False
It gives an error, do you know why? How can I fix it?