Home > Blockchain >  Is there an equivalent to get_focus() in Tkinter for <"Enter">?
Is there an equivalent to get_focus() in Tkinter for <"Enter">?

Time:02-18

In Tkinter for the event <"FocusIn"> (which you can bind to a widget), you have like the "reversed" function .get_focus(), which will show you the name of the widget, which has the focus at the moment.
For the event <"Enter"> (which means that the mouse cursor is hovering over some widget) is there an equivalent "reverse" function? Something like ".get_entered()" or similar, to show you the name of the widget that the mouse cursor is hovering over?

CodePudding user response:

To find out which widget is under the cursor you can use the winfo_containing method.

x, y = root.winfo_pointerxy()
widget = root.winfo_containing(x,y)
  • Related