Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
GTK4: Fix forward application of set_size_inches
  • Loading branch information
QuLogic committed Oct 20, 2021
commit 4b5328d4170feb962abea779f24796c971e3422b
13 changes: 3 additions & 10 deletions lib/matplotlib/backends/backend_gtk4.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,10 @@ def set_window_title(self, title):
def resize(self, width, height):
"""Set the canvas size in pixels."""
if self.toolbar:
toolbar_size = self.toolbar.size_request()
height += toolbar_size.height
min_size, nat_size = self.toolbar.get_preferred_size()
height += nat_size.height
canvas_size = self.canvas.get_allocation()
if canvas_size.width == canvas_size.height == 1:
# A canvas size of (1, 1) cannot exist in most cases, because
# window decorations would prevent such a small window. This call
# must be before the window has been mapped and widgets have been
# sized, so just change the window's starting size.
self.window.set_default_size(width, height)
else:
self.window.resize(width, height)
self.window.set_default_size(width, height)


class NavigationToolbar2GTK4(_NavigationToolbar2GTK, Gtk.Box):
Expand Down