📌  相关文章
📜  在悬停的 tkinter 上更改按钮的颜色 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:11.859000             🧑  作者: Mango

代码示例2
import tkinter as tk

def on_enter(e):
    myButton['background'] = 'green'

def on_leave(e):
    myButton['background'] = 'SystemButtonFace'

root = tk.Tk()
myButton = tk.Button(root,text="Click Me")
myButton.grid()


myButton.bind("", on_enter)
myButton.bind("", on_leave)

root.mainloop()