Hello list,
I'd like to bring something back, which was discussed in sep-dec 2008 "OSX
10.5 event.key bug", which was initially posted by James Schombert.
Did I miss any development in this field?
I tried to implement the latest proposal, which allows you to switch off the
mpl-axes-interaction during key_press_event's for a specific axes using
ax.set_auto_key_press(False)
Therefore I changed the backend_bases.py and the axes.py (see attachement).
If this is a suitable solution, one could switch off the mpl-axes-interaction
during key_press_event's for all axes belonging to a button, slider, ... .
Kind regards,
Matthias
Index: lib/matplotlib/axes.py
===================================================================
--- lib/matplotlib/axes.py (revision 8171)
+++ lib/matplotlib/axes.py (working copy)
@@ -457,8 +457,8 @@
self._cachedRenderer = None
self.set_navigate(True)
self.set_navigate_mode(None)
+ self.set_auto_key_press(True)
-
if xscale:
self.set_xscale(xscale)
if yscale:
@@ -2404,6 +2404,20 @@
"""
self._navigate_mode = b
+ def set_auto_key_press(self, b):
+ """
+ Enable / Disable processing of key-press events in
+ backend_bases.FigureManagerBase.key_press for this axes.
+ """
+ self._auto_key_press = b
+
+ def get_auto_key_press(self, b):
+ """
+ Get current status of processing of key-press events in
+ backend_bases.FigureManagerBase.key_press for this axes.
+ """
+ return self._auto_key_press
+
def start_pan(self, x, y, button):
"""
Called when a pan operation has started.
Index: lib/matplotlib/backend_bases.py
===================================================================
--- lib/matplotlib/backend_bases.py (revision 8171)
+++ lib/matplotlib/backend_bases.py (working copy)
@@ -1883,6 +1883,9 @@
def key_press(self, event):
+ if event.inaxes._auto_key_press is False:
+ return
+
# these bindings happen whether you are over an axes or not
#if event.key == 'q':
# self.destroy() # how cruel to have to destroy oneself!
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users