I need that when an activated flag and pressing the button performed some kind of function. And with the deactivated flag and press the other function button. How can I do that?

Code with CheckButton:

def new_window ():
    new_window= TK.Toplevel (Window)
    new_window.geometry (f "700x300 + 500 + 300")
    new_window.Resizable (width= false, height= false)
    new_window.title ("User1")
    Val= TK.StringVar ()
    Val.set ("")
    QWERTY= TK.BUTTON (new_window, text= "get", Command= None)
    QWERTY.PLACE (X= 2, Y= 30)
    checkButton1= TK.CheckButton (new_window, text= "something", variable= val, onvalue= 0, offvalue= 1)
    checkbutton1.place (x= 2, y= 16)

How can this be done? I need that with the activated flag, when you press the button, some kind of function happened ...

Г Г2021-05-03 21:02:27