How to change colors of multiple widgets after hovering in Tkinter

Rick Johnson rantingrickjohnson at gmail.com
Fri Jan 11 06:43:00 CET 2013


On Thursday, January 10, 2013 1:13:38 PM UTC-6, Peter Otten wrote:
> mountdoom wrote:
> > I´m trying to make a script, which will change the background and
> > foreground color of widgets after hovering.

Peter's advice is spot on except you may want ALL widgets to change colors on <ENTER> and <LEAVE> events. If you want all widgets use the "w.bind_all" method instead of "w.bind". Also check out the "w.bind_class" method to confine bindings to one particular class of widget (like a Tkinter.Button).



More information about the Python-list mailing list