From c1fbfe1f94e01a0bb2753ba8b52947c2a68761c8 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 6 Nov 2021 13:07:26 +0100 Subject: [PATCH] Fix check for manager presence in blocking_input. This was missed in 3ccc17b. --- lib/matplotlib/_blocking_input.py | 2 +- lib/matplotlib/blocking_input.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/_blocking_input.py b/lib/matplotlib/_blocking_input.py index 5842f7f3fb30..45f077571443 100644 --- a/lib/matplotlib/_blocking_input.py +++ b/lib/matplotlib/_blocking_input.py @@ -18,7 +18,7 @@ def blocking_input_loop(figure, event_names, timeout, handler): Function called for each event; it can force an early exit of the event loop by calling ``canvas.stop_event_loop()``. """ - if hasattr(figure.canvas, "manager"): + if figure.canvas.manager: figure.show() # Ensure that the figure is shown if we are managing it. # Connect the events to the on_event function call. cids = [figure.canvas.mpl_connect(name, handler) for name in event_names] diff --git a/lib/matplotlib/blocking_input.py b/lib/matplotlib/blocking_input.py index 4a0082e24043..f59a54ff7343 100644 --- a/lib/matplotlib/blocking_input.py +++ b/lib/matplotlib/blocking_input.py @@ -83,7 +83,7 @@ def __call__(self, n=1, timeout=30): self.n = n self.events = [] - if hasattr(self.fig.canvas, "manager"): + if self.figure.canvas.manager: # Ensure that the figure is shown, if we are managing it. self.fig.show() # Connect the events to the on_event function call.