Python 3.x 当鼠标悬停在Tkinter中的按钮上时,如何停止颜色变化?

Python 3.x 当鼠标悬停在Tkinter中的按钮上时,如何停止颜色变化?,python-3.x,tkinter,Python 3.x,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,您

我不想把颜色改成别的颜色。我希望当鼠标悬停在按钮上时,该按钮不会将颜色更改为浅灰色。在特金特有什么办法吗

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')

在Windows上,使用python 3.6.5时,普通tkinter按钮在其上悬停时不会改变颜色。你能分享一些显示这种行为的代码并分享你正在使用的操作系统吗?我假设你使用
ttk
按钮,而不是使用
tk
按钮来获得正常效果将
activebackground
颜色配置为与
bg
颜色相同的颜色。