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

Skip to content

Commit 7fb21c6

Browse files
committed
Revert to using update() instead of redraw() for Qt5/Win
1 parent 0870c50 commit 7fb21c6

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

lib/matplotlib/backends/backend_qt4agg.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,6 @@ def __init__(self, figure):
7373
self._drawRect = None
7474
self.blitbox = None
7575
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
76-
# it has been reported that Qt is semi-broken in a windows
77-
# environment. If `self.draw()` uses `update` to trigger a
78-
# system-level window repaint (as is explicitly advised in the
79-
# Qt documentation) the figure responds very slowly to mouse
80-
# input. The work around is to directly use `repaint`
81-
# (against the advice of the Qt documentation). The
82-
# difference between `update` and repaint is that `update`
83-
# schedules a `repaint` for the next time the system is idle,
84-
# where as `repaint` repaints the window immediately. The
85-
# risk is if `self.draw` gets called with in another `repaint`
86-
# method there will be an infinite recursion. Thus, we only
87-
# expose windows users to this risk.
88-
if sys.platform.startswith('win'):
89-
self._priv_update = self.repaint
90-
else:
91-
self._priv_update = self.update
9276

9377

9478
FigureCanvas = FigureCanvasQTAgg

lib/matplotlib/backends/backend_qt5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def stop_event_loop(self):
416416
stop_event_loop.__doc__ = FigureCanvasBase.stop_event_loop_default.__doc__
417417

418418
def draw_idle(self):
419-
self._priv_update()
419+
self.update()
420420

421421

422422
class MainWindow(QtWidgets.QMainWindow):

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def draw(self):
147147
# causes problems with code that uses the result of the
148148
# draw() to update plot elements.
149149
FigureCanvasAgg.draw(self)
150-
self._priv_update()
150+
self.update()
151151

152152
def blit(self, bbox=None):
153153
"""
@@ -184,22 +184,6 @@ def __init__(self, figure):
184184
self._drawRect = None
185185
self.blitbox = None
186186
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
187-
# it has been reported that Qt is semi-broken in a windows
188-
# environment. If `self.draw()` uses `update` to trigger a
189-
# system-level window repaint (as is explicitly advised in the
190-
# Qt documentation) the figure responds very slowly to mouse
191-
# input. The work around is to directly use `repaint`
192-
# (against the advice of the Qt documentation). The
193-
# difference between `update` and repaint is that `update`
194-
# schedules a `repaint` for the next time the system is idle,
195-
# where as `repaint` repaints the window immediately. The
196-
# risk is if `self.draw` gets called with in another `repaint`
197-
# method there will be an infinite recursion. Thus, we only
198-
# expose windows users to this risk.
199-
if sys.platform.startswith('win'):
200-
self._priv_update = self.repaint
201-
else:
202-
self._priv_update = self.update
203187

204188

205189
FigureCanvas = FigureCanvasQTAgg

0 commit comments

Comments
 (0)