File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -374,17 +374,10 @@ def set_window_title(self, title):
374
374
def resize (self , width , height ):
375
375
"""Set the canvas size in pixels."""
376
376
if self .toolbar :
377
- toolbar_size = self .toolbar .size_request ()
378
- height += toolbar_size .height
377
+ min_size , nat_size = self .toolbar .get_preferred_size ()
378
+ height += nat_size .height
379
379
canvas_size = self .canvas .get_allocation ()
380
- if canvas_size .width == canvas_size .height == 1 :
381
- # A canvas size of (1, 1) cannot exist in most cases, because
382
- # window decorations would prevent such a small window. This call
383
- # must be before the window has been mapped and widgets have been
384
- # sized, so just change the window's starting size.
385
- self .window .set_default_size (width , height )
386
- else :
387
- self .window .resize (width , height )
380
+ self .window .set_default_size (width , height )
388
381
389
382
390
383
class NavigationToolbar2GTK4 (_NavigationToolbar2GTK , Gtk .Box ):
You can’t perform that action at this time.
0 commit comments