Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6dbedd7

Browse files
committed
handle is None keys by returning
svn path=/trunk/matplotlib/; revision=8367
1 parent 4797b41 commit 6dbedd7

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,9 @@ def key_press(self, event):
20622062
# self.destroy() # how cruel to have to destroy oneself!
20632063
# return
20642064

2065+
if event.key is None:
2066+
return
2067+
20652068
# Load key-mappings from your matplotlibrc file.
20662069
fullscreen_keys = rcParams['keymap.fullscreen']
20672070
home_keys = rcParams['keymap.home']
@@ -2128,8 +2131,7 @@ def key_press(self, event):
21282131
ax.set_xscale('log')
21292132
ax.figure.canvas.draw()
21302133

2131-
elif event.key is not None and \
2132-
(event.key.isdigit() and event.key!='0') or event.key in all:
2134+
elif (event.key.isdigit() and event.key!='0') or event.key in all:
21332135
# keys in list 'all' enables all axes (default key 'a'),
21342136
# otherwise if key is a number only enable this particular axes
21352137
# if it was the axes, where the event was raised

lib/matplotlib/image.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,13 @@ def set_data(self, x, y, A):
663663
self._Ay = y
664664
self._imcache = None
665665

666+
# I am adding this in accor with _AxesImageBase.set_data --
667+
# examples/pylab_examples/image_nonuniform.py was breaking on
668+
# the call to _get_unsampled_image when the oldxslice attr was
669+
# accessed - JDH 3/3/2010
670+
self._oldxslice = None
671+
self._oldyslice = None
672+
666673
def set_array(self, *args):
667674
raise NotImplementedError('Method not supported')
668675

0 commit comments

Comments
 (0)