简体   繁体   中英

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

I want to add a hover effect over Notebook tabs. 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')


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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