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

Skip to content

Commit ce62902

Browse files
committed
Use try/except instead of hasattr
1 parent ee16b6c commit ce62902

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2479,8 +2479,10 @@ def key_press_handler(event, canvas, toolbar=None):
24792479

24802480
# toggle fullscreen mode (default key 'f')
24812481
if event.key in fullscreen_keys:
2482-
if hasattr(canvas, 'manager'):
2482+
try:
24832483
canvas.manager.full_screen_toggle()
2484+
except AttributeError:
2485+
pass
24842486

24852487
# quit the figure (defaut key 'ctrl+w')
24862488
if event.key in quit_keys:

0 commit comments

Comments
 (0)