Remove auto-call to canvas.draw_idle in ResizeEvent processing. · matplotlib/matplotlib@eb9bef4 · GitHub
Skip to content

Commit eb9bef4

Browse files
committed
Remove auto-call to canvas.draw_idle in ResizeEvent processing.
Backends can call draw_idle themselves. Note that 1) this was already done by the gtk backends, and 2) this may actually be unneeded, as figure.set_size_inches (which is always called a bit earlier by the various resize handlers) also marks the figure as stale, which should trigger a redraw too. Still, let's add the draw_idle calls to be safe, they shouldn't be costly as both draws should get compressed together; we can always investigate removing them later.
1 parent bb1d42e commit eb9bef4

5 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 4 deletions

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def resize(self, event):
241241
self._tkcanvas.create_image(
242242
int(width / 2), int(height / 2), image=self._tkphoto)
243243
ResizeEvent("resize_event", self)._process()
244+
self.draw_idle()
244245

245246
def draw_idle(self):
246247
# docstring inherited

lib/matplotlib/backends/backend_qt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def resizeEvent(self, event):
348348
QtWidgets.QWidget.resizeEvent(self, event)
349349
# emit our resize events
350350
ResizeEvent("resize_event", self)._process()
351+
self.draw_idle()
351352

352353
def sizeHint(self):
353354
w, h = self.get_width_height()

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ def handle_resize(self, event):
343343
self._png_is_old = True
344344
self.manager.resize(*fig.bbox.size, forward=False)
345345
ResizeEvent('resize_event', self)._process()
346+
self.draw_idle()
346347

347348
def handle_send_image_mode(self, event):
348349
# The client requests notification of what the current image mode is.

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)