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

Skip to content

Commit c118579

Browse files
FIX: resize tk.PhotoImage instead of recreate
prevents flickering in certain edge cases (like if draw_idle is overridden)
1 parent 40ea023 commit c118579

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ def resize(self, event):
258258
self.figure.set_size_inches(winch, hinch, forward=False)
259259

260260
self._tkcanvas.delete(self._tkcanvas_image_region)
261-
self._tkphoto = tk.PhotoImage(
262-
master=self._tkcanvas, width=int(width), height=int(height))
261+
self._tkphoto.configure(width=int(width), height=int(height))
263262
self._tkcanvas_image_region = self._tkcanvas.create_image(
264263
int(width / 2), int(height / 2), image=self._tkphoto)
265264
ResizeEvent("resize_event", self)._process()

0 commit comments

Comments
 (0)