python-3.x - 将鼠标悬停在 Tkinter 中的按钮上时如何停止颜色变化?
问题描述
i我不想将颜色更改为其他任何颜色。我希望按钮在悬停在其上时不会将颜色更改为浅灰色。有没有办法在 Tkinter 中做到这一点。
from tkinter import *
window = Tk()
button = Button(window, text="ok", fg='white', bg='black')
button.grid(row=0, column=0, padx=0, pady=0)
window.mainloop()
顺便说一下,我使用的是 Ubuntu 20.04
解决方案
您可以将activeforeground
颜色设置为与颜色相同,将fg
颜色设置为与activebackground
颜色相同bg
:
button = Button(window, text="ok", fg='white', bg='black',
activeforeground='white', activebackground='black')
推荐阅读
- javascript - json 值不接受特殊字符
- javascript - Angular - 调整大小更改 html 元素
- java - 如何告诉 assertJsonEquals 在比较时忽略一个字段
- javascript - 正则表达式仅输入允许的模式(输入文本)
- apache-nifi - Apache NiFi JoltTransformJSON processor attribute as jolt spec
- powershell - 获取站点集合中包含 5000 个项目的列表
- c# - 以列表作为对象属性的对象列表
- java - 如何识别字符串是用Base64编码的
- java - 如何在视图中更改孩子的背景
- javascript - Quasar Button 组件中的图标不会改变大小