diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index f70bf6f1dc5f..7295ba1e8e22 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -506,7 +506,8 @@ def draw_idle(self): # current event loop in order to ensure thread affinity and to # accumulate multiple draw requests from event handling. # TODO: queued signal connection might be safer than singleShot - if not (self._draw_pending or self._is_drawing): + if not (getattr(self, '_draw_pending', False) or + getattr(self, '._is_drawing', False)): self._draw_pending = True QtCore.QTimer.singleShot(0, self._draw_idle)