Skip to content

Commit

Permalink
Backport PR #19052: Always pass integers to wx.Size.
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell authored and meeseeksmachine committed Jan 27, 2021
1 parent d262e53 commit 491c957
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,8 @@ def __init__(self, num, fig):
_set_frame_icon(self)

self.canvas = self.get_canvas(fig)
self.canvas.SetInitialSize(wx.Size(fig.bbox.width, fig.bbox.height))
w, h = map(math.ceil, fig.bbox.size)
self.canvas.SetInitialSize(wx.Size(w, h))
self.canvas.SetFocus()
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
Expand Down Expand Up @@ -1070,7 +1071,8 @@ def set_window_title(self, title):

def resize(self, width, height):
# docstring inherited
self.canvas.SetInitialSize(wx.Size(width, height))
self.canvas.SetInitialSize(
wx.Size(math.ceil(width), math.ceil(height)))
self.window.GetSizer().Fit(self.window)


Expand Down

0 comments on commit 491c957

Please sign in to comment.