8000 suppress exception upon quitting with qt4agg on osx · matplotlib/matplotlib@9520d9f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9520d9f

Browse files
committed
suppress exception upon quitting with qt4agg on osx
1 parent 551f11b commit 9520d9f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,11 +1599,13 @@ def close_event(self, guiEvent=None):
15991599
try:
16001600
event = CloseEvent(s, self, guiEvent=guiEvent)
16011601
self.callbacks.process(s, event)
1602-
except TypeError:
1602+
except (TypeError, AttributeError):
16031603
pass
16041604
# Suppress the TypeError when the python session is being killed.
16051605
# It may be that a better solution would be a mechanism to
16061606
# disconnect all callbacks upon shutdown.
1607+
# AttributeError occurs on OSX with qt4agg upon exiting
1608+
# with an open window; 'callbacks' attribute no longer exists.
16071609

16081610
def key_press_event(self, key, guiEvent=None):
16091611
"""
@@ -2417,12 +2419,12 @@ def __init__(self, canvas, num):
24172419
self.key_press)
24182420
"""
24192421
The returned id from connecting the default key handler via :meth:`FigureCanvasBase.mpl_connnect`.
2420-
2422+
24212423
To disable default key press handling::
2422-
2424+
24232425
manager, canvas = figure.canvas.manager, figure.canvas
24242426
canvas.mpl_disconnect(manager.key_press_handler_id)
2425-
2427+
24262428
"""
24272429

24282430
def destroy(self):

0 commit comments

Comments
 (0)
0