diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index baf76593cc57..ce788cc320e0 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -10,6 +10,8 @@ import matplotlib +import time as ttime + from matplotlib.cbook import is_string_like from matplotlib.backend_bases import FigureManagerBase from matplotlib.backend_bases import FigureCanvasBase @@ -242,6 +244,7 @@ def __init__(self, figure): self._idle = True w, h = self.get_width_height() self.resize(w, h) + self._last_mouse_move_time = 0 def enterEvent(self, event): FigureCanvasBase.enter_notify_event(self, guiEvent=event) @@ -274,6 +277,11 @@ def mouseDoubleClickEvent(self, event): print('button doubleclicked:', event.button()) def mouseMoveEvent(self, event): + cur_time = ttime.time() + if cur_time - self._last_mouse_move_time < 1 / 30: + return + self._last_mouse_move_time = cur_time + x = event.x() # flipy so y=0 is bottom of canvas y = self.figure.bbox.height - event.y()