如何在 Tkinter 笔记本选项卡上添加悬停效果?

时间:2021-01-23 05:20:49

标签: python tkinter

我想在笔记本标签上添加悬停效果。我用过这个方法:

def hover(widget, on_entrance, on_exit, entrance_fg, exit_fg):
    widget.bind("<Enter>", func=lambda e: widget.config(
                bg=on_entrance, fg=entrance_fg))
    widget.bind("<Leave>", func=lambda e: widget.config(
                bg=on_exit, fg=exit_fg))

它没有显示任何错误,但它不起作用。

1 个答案:

答案 0 :(得分:1)

试试这个:

hover(your_widget, on_entrance='your_color', on_exit='your_color, entrance_fg='your_color', exxit_fg='your_color')


相关问题