Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,11 +1599,13 @@ def close_event(self, guiEvent=None):
try:
event = CloseEvent(s, self, guiEvent=guiEvent)
self.callbacks.process(s, event)
except TypeError:
except (TypeError, AttributeError):
pass
# Suppress the TypeError when the python session is being killed.
# It may be that a better solution would be a mechanism to
# disconnect all callbacks upon shutdown.
# AttributeError occurs on OSX with qt4agg upon exiting
# with an open window; 'callbacks' attribute no longer exists.

def key_press_event(self, key, guiEvent=None):
"""
Expand Down Expand Up @@ -2417,12 +2419,12 @@ def __init__(self, canvas, num):
self.key_press)
"""
The returned id from connecting the default key handler via :meth:`FigureCanvasBase.mpl_connnect`.

To disable default key press handling::

manager, canvas = figure.canvas.manager, figure.canvas
canvas.mpl_disconnect(manager.key_press_handler_id)

"""

def destroy(self):
Expand Down