简体   繁体   English

如何在 Tkinter 笔记本标签上添加 hover 效果?

[英]How can I add a hover effect over Tkinter notebook tab?

I want to add a hover effect over Notebook tabs.我想在笔记本标签上添加 hover 效果。 I used this method:我用了这个方法:

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

It is not showing any error, but it is not working.它没有显示任何错误,但它不起作用。

Try this:尝试这个:

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


声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM