python-3.x - ttk.Spinbox 总是突出价值
问题描述
我意识到ttk.Spinbox
似乎总是突出显示通过向上或向下按钮选择的新值。有没有办法避免这个功能?可以selectbackground=<background color>, selectforeground=<foreground color>
在 Style 中设置,但这只是隐藏了问题。
- 操作系统:Windows 10 家庭版
- 总热量/总热量:8.6
- 蟒蛇:3.7.3
可重现的例子:
from tkinter import Tk
from tkinter.ttk import Spinbox, Style
root = Tk()
spinbox = Spinbox(root, from_=0, to=10)
spinbox.pack(expand=True)
### How to hide it
style = Style(root)
style.configure('TSpinbox',
selectbackground=style.configure('TSpinbox', 'background'), #set selectforeground to foreground
selectforeground=style.configure('TSpinbox', 'foreground')) #set selectbackground to background
###
root.mainloop()
解决方案
推荐阅读
- c - 以下格式说明符在做什么?
- javascript - 可折叠框未在 html 和 css 中显示我的所有文本
- python - EOFError:当我加载具有字典对象的泡菜文件时出现输入错误
- javascript - 仅在 2 周内启用日期格式 html
- c# - HttpClient 和 IHttpClientFactory 继承逻辑
- api - 如何编写通用函数来设置从一个 GET API 接收的令牌和 cookie 以使用 Rest Assured 测试其他 API
- macos - Firebase Emulator slow when using 0.0.0.0 host
- typescript - 为什么打字稿会抛出有关静态定义的错误
- c++ - 使用 pkgconfig 调试 makefile
- python - 给定一维和一个常数,有效地创建二维 numpy 数组