python - 我们可以让 tkinter spinbox 返回一个布尔值吗?
问题描述
我知道 tkinter spinbox 返回一组值,我们可以稍后通过 using.get
方法使用该值。但是是否可以创建一个只返回 2 个输出(True 或 False)的 tkinter spinbox?
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
我想知道是否可以使用返回 True 或 False 的旋转框来代替此处的第二个复选框。
解决方案
推荐阅读
- android - 导航组件 - 选择 BottomNavigationView 的项目时显示不同的目的地
- java - Java Heap在游戏过程中增长然后重置是否正常?
- c# - 如何删除项目参考中的循环依赖
- function - 如何将函数与表连接起来并将表列作为参数传递给雪花中的函数
- python - Python Discord bot 非大写敏感
- java - 如何将字符转换为字符串
- python - 根据另一列的值更改相邻列的值
- gradle - 在 Gradle Kotlin DSL 中运行 ElasticSearch
- c# - 如何在 asp.net c# 中将 JQuery DataTables 应用于 Gridview 以获取大数据(> 1000)?
- ms-access - MS Access隐藏列值从组合框到另一个字段