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

Skip to content

qt backend draw_idle doesn't work #4944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2015
Merged
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
16 changes: 15 additions & 1 deletion lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,21 @@ def stop_event_loop(self):
stop_event_loop.__doc__ = FigureCanvasBase.stop_event_loop_default.__doc__

def draw_idle(self):
self.update()
# This cannot be a call to 'update', we need a slightly longer
# delay, otherwise mouse releases from zooming, panning, or
# lassoing might not finish processing and will not redraw properly.
# We use the guard flag to prevent infinite calls to 'draw_idle' which
# happens with the 'stale' figure & axes callbacks.
d = self._idle
self._idle = False

def idle_draw(*args):
try:
self.draw()
finally:
self._idle = True
if d:
QtCore.QTimer.singleShot(0, idle_draw)


class MainWindow(QtWidgets.QMainWindow):
Expand Down