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

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down