How to detect when a pressed mouse enters a widget in a different Frame How to detect when a pressed mouse enters a widget in a different Frame tkinter tkinter

How to detect when a pressed mouse enters a widget in a different Frame


You will need to set a binding on <B1-Motion>. Then, in the callback you can use the winfo_containing method to determine which widget is under the cursor. You can use event.x_root and event.y_root as arguments to winfo_containing to find the widget:

self.bind_all("<B1-Motion>", self.on_motion)...def on_motion(self, event):    widget = self.winfo_containing(event.x_root, event.y_root)    ...