Python 我们可以让tkinter spinbox返回布尔值吗?

Python 我们可以让tkinter spinbox返回布尔值吗?,python,tkinter,spinbox,Python,Tkinter,Spinbox,我知道tkinter spinbox返回一组值,我们可以稍后使用.get方法使用该值。但是,是否可以创建一个只返回2个输出(真或假)的tkinter spinbox 我想知道我是否可以使用返回True或False的spinbox来代替这里的第二个复选按钮。为什么不使用tkinter.Radiobutton或tkinter.checkbutton?是什么阻止了你这么做?@TheLizzard我想spinbox占用的空间更少space@MatiissSpinboxes用于ints,Checkbutt

我知道tkinter spinbox返回一组值,我们可以稍后使用
.get
方法使用该值。但是,是否可以创建一个只返回2个输出(真或假)的tkinter spinbox


我想知道我是否可以使用返回True或False的spinbox来代替这里的第二个复选按钮。

为什么不使用
tkinter.Radiobutton
tkinter.checkbutton
?是什么阻止了你这么做?@TheLizzard我想spinbox占用的空间更少space@Matiiss
Spinbox
es用于
int
s,
Checkbutton
s用于
bool
s,
Text
s/
Entry
s用于字符串。我建议您尝试执行
Checkbutton
,然后在此处发布问题。
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