diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index eb08c734af20..fc6639914d35 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -898,7 +898,7 @@ def _tight_layout(self): self._figure.tight_layout() for attr, spinbox in self._spinboxes.items(): spinbox.blockSignals(True) - spinbox.setValue(vars(self._figure.subplotpars)[attr]) + spinbox.setValue(getattr(self._figure.subplotpars, attr)) spinbox.blockSignals(False) self._figure.canvas.draw_idle() diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 04b9bdb79ab2..eef477e34aaa 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -325,11 +325,12 @@ def draw_if_interactive(): # show is already present, as the latter may be here for backcompat. manager_class = getattr(getattr(backend_mod, "FigureCanvas", None), "manager_class", None) - # We can't compare directly manager_class.pyplot_show and FMB.pyplot_show - # because pyplot_show is a classmethod so the above constructs are bound - # classmethods, & thus always different (being bound to different classes). - manager_pyplot_show = vars(manager_class).get("pyplot_show") - base_pyplot_show = vars(FigureManagerBase).get("pyplot_show") + # We can't compare directly manager_class.pyplot_show and FMB.pyplot_show because + # pyplot_show is a classmethod so the above constructs are bound classmethods, and + # thus always different (being bound to different classes). We also have to use + # getattr_static instead of vars as manager_class could have no __dict__. + manager_pyplot_show = inspect.getattr_static(manager_class, "pyplot_show", None) + base_pyplot_show = inspect.getattr_static(FigureManagerBase, "pyplot_show", None) if (show is None or (manager_pyplot_show is not None and manager_pyplot_show != base_pyplot_show)):