Commit ee16b6c
committed
Avoid possible exception when toggling full-screen
In `examples/user_interfaces/embedding_in_tk.py`, a FigureCanvasTkAgg is embedded into a Tkinter window and the default mpl key bindings are implemented with matplotlib.backend_bases.key_press_handler. If the user attempts to toggle full-screen mode by pressing 'f', an AttributeError is raised because the FigureCanvasTkAgg has no 'manager' attribute. Indeed, since pyplot is not being used, no FigureManagerTkAgg object gets created.
One fix is to check for the 'manager' attribute and do nothing if it doesn't exist. (This is what is done in FigureCanvasBase.get_window_title/set_window_title, for example.)1 parent 263c06a commit ee16b6c
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2479 | 2479 | | |
2480 | 2480 | | |
2481 | 2481 | | |
2482 | | - | |
| 2482 | + | |
| 2483 | + | |
2483 | 2484 | | |
2484 | 2485 | | |
2485 | 2486 | | |
| |||
0 commit comments