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

Skip to content

Commit 9984f9c

Browse files
authored
Merge pull request #16028 from anntzer/qtrecursivedraw
Prevent FigureCanvasQT_draw_idle recursively calling itself.
2 parents 163aac0 + 7a51cac commit 9984f9c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,17 +481,16 @@ def draw_idle(self):
481481
QtCore.QTimer.singleShot(0, self._draw_idle)
482482

483483
def _draw_idle(self):
484-
if self.height() < 0 or self.width() < 0:
485-
self._draw_pending = False
486484
if not self._draw_pending:
487485
return
486+
self._draw_pending = False
487+
if self.height() < 0 or self.width() < 0:
488+
return
488489
try:
489490
self.draw()
490491
except Exception:
491492
# Uncaught exceptions are fatal for PyQt5, so catch them instead.
492493
traceback.print_exc()
493-
finally:
494-
self._draw_pending = False
495494

496495
def drawRectangle(self, rect):
497496
# Draw the zoom rectangle to the QPainter. _draw_rect_callback needs

0 commit comments

Comments
 (0)