Can we make a tkinter spinbox return a boolean value?

74 Views Asked by At

I know that tkinter spinbox returns a set of values and we can use that value later by using .get method. But is it possible to create a tkinter spinbox which just returns 2 outputs (True or False) ?

def apply():
    if (toggle_var.get() == "ON"):
        # changing on/off state will start/stop the plot
        def dark():
            if (dark_var.get() == "ON"):
                print('do something from a function here')
            else:
                print('do some other thing')
            
        # Button to toggle between dark/no dark state
    
# Button to toggle between on/off state 

I am wondering if I can use a spinbox returning True or False can be used instead of the second checkbutton here.

0

There are 0 best solutions below