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 6730eb4

Browse filesBrowse files
committed
Exposed the callback id for the default key press handler so that it can be easily diabled. Fixes #215.
1 parent 267b0cf commit 6730eb4
Copy full SHA for 6730eb4

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2413,7 +2413,17 @@ def __init__(self, canvas, num):
24132413
canvas.manager = self # store a pointer to parent
24142414
self.num = num
24152415

2416-
self.canvas.mpl_connect('key_press_event', self.key_press)
2416+
self.key_press_handler_id = self.canvas.mpl_connect('key_press_event',
2417+
self.key_press)
2418+
"""
2419+
The returned id from connecting the default key handler via :meth:`FigureCanvasBase.mpl_connnect`.
2420+
2421+
To disable default key press handling::
2422+
2423+
manager, canvas = figure.canvas.manager, figure.canvas
2424+
canvas.mpl_disconnect(manager.key_press_handler_id)
2425+
2426+
"""
24172427

24182428
def destroy(self):
24192429
pass

0 commit comments

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