Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64e37bc

Browse filesBrowse files
committed
Enable enter/leave notify for tk
1 parent 3fdd527 commit 64e37bc
Copy full SHA for 64e37bc

File tree

Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed

‎lib/matplotlib/backends/_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_tk.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ def __init__(self, figure, master=None, resize_callback=None):
178178
self._tkcanvas.bind("<Configure>", self.resize)
179179
self._tkcanvas.bind("<Key>", self.key_press)
180180
self._tkcanvas.bind("<Motion>", self.motion_notify_event)
181+
self._tkcanvas.bind("<Enter>", self.enter_notify_event)
182+
self._tkcanvas.bind("<Leave>", self.leave_notify_event)
181183
self._tkcanvas.bind("<KeyRelease>", self.key_release)
182184
for name in "<Button-1>", "<Button-2>", "<Button-3>":
183185
self._tkcanvas.bind(name, self.button_press_event)
@@ -326,6 +328,11 @@ def motion_notify_event(self, event):
326328
y = self.figure.bbox.height - event.y
327329
FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event)
328330

331+
def enter_notify_event(self, event):
332+
x = event.x
333+
# flipy so y=0 is bottom of canvas
334+
y = self.figure.bbox.height - event.y
335+
FigureCanvasBase.enter_notify_event(self, guiEvent=event, xy=(x, y))
329336

330337
def button_press_event(self, event, dblclick=False):
331338
x = event.x

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.