Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 84f69e0

Browse filesBrowse 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 c61bf1b commit 84f69e0
Copy full SHA for 84f69e0

File tree

Expand file treeCollapse file tree

5 files changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+4
-4
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,10 +1277,6 @@ def __init__(self, name, canvas):
12771277
super().__init__(name, canvas)
12781278
self.width, self.height = canvas.get_width_height()
12791279

1280-
def _process(self):
1281-
super()._process()
1282-
self.canvas.draw_idle()
1283-
12841280

12851281
class CloseEvent(Event):
12861282
"""An event triggered by a figure being closed."""

‎lib/matplotlib/backends/_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_tk.py
+1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt.py
+1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_webagg_core.py
+1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_wx.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ def _on_size(self, event):
705705
# the whole background is repainted.
706706
self.Refresh(eraseBackground=False)
707707
ResizeEvent("resize_event", self)._process()
708+
self.draw_idle()
708709

709710
def _get_key(self, event):
710711

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.