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

Skip to content

Commit 36059d8

Browse files
committed
nbagg: Don't send events if manager is disconnected.
This occurs, e.g., when saving figures, as one of the first things `print_figure` does is to remove the figure manager. This does mean that nbagg won't be able to set the wait cursor when saving a file, but before 0944dcb that was not being done, and after, saving was broken, so there's no net loss. Fixes #16721.
1 parent a00fdf1 commit 36059d8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ def handle_set_dpi_ratio(self, event):
341341
self.draw_idle()
342342

343343
def send_event(self, event_type, **kwargs):
344-
self.manager._send_event(event_type, **kwargs)
344+
if self.manager:
345+
self.manager._send_event(event_type, **kwargs)
345346

346347

347348
_JQUERY_ICON_CLASSES = {

0 commit comments

Comments
 (0)