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

Skip to content

Commit 42a646f

Browse files
committed
Fix _FigureManagerGTK.resize on GTK4
Using the same method as __init__ to avoid the deprecated-in-GTK3 and removed-in-GTK4 API. Closes matplotlib#24015
1 parent 6fb17d9 commit 42a646f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/backends/_backend_gtk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ def resize(self, width, height):
233233
width = int(width / self.canvas.device_pixel_ratio)
234234
height = int(height / self.canvas.device_pixel_ratio)
235235
if self.toolbar:
236-
toolbar_size = self.toolbar.size_request()
237-
height += toolbar_size.height
236+
min_size, nat_size = self.toolbar.get_preferred_size()
237+
height += nat_size.height
238238
canvas_size = self.canvas.get_allocation()
239239
if self._gtk_ver >= 4 or canvas_size.width == canvas_size.height == 1:
240240
# A canvas size of (1, 1) cannot exist in most cases, because

0 commit comments

Comments
 (0)