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

Skip to content

Commit 53e5aac

Browse files
committed
FIX: work with PyQt 5.15
Two places where we used to pass floats that must now be integers.
1 parent f33226f commit 53e5aac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ def start_event_loop(self, timeout=0):
430430
raise RuntimeError("Event loop already running")
431431
self._event_loop = event_loop = QtCore.QEventLoop()
432432
if timeout:
433-
timer = QtCore.QTimer.singleShot(timeout * 1000, event_loop.quit)
433+
timer = QtCore.QTimer.singleShot(round(timeout * 1000),
434+
event_loop.quit)
434435
event_loop.exec_()
435436

436437
def stop_event_loop(self, event=None):
@@ -465,7 +466,7 @@ def blit(self, bbox=None):
465466
if bbox is None and self.figure:
466467
bbox = self.figure.bbox # Blit the entire canvas if bbox is None.
467468
# repaint uses logical pixels, not physical pixels like the renderer.
468-
l, b, w, h = [pt / self._dpi_ratio for pt in bbox.bounds]
469+
l, b, w, h = [round(pt / self._dpi_ratio) for pt in bbox.bounds]
469470
t = b + h
470471
self.repaint(l, self.rect().height() - t, w, h)
471472

0 commit comments

Comments
 (0)