Skip to content
Closed
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
Prev Previous commit
Next Next commit
FigureCanvasWx: use GetMinSize if the item is fixed size or not manag…
…ed by a sizer
  • Loading branch information
DietmarSchwertberger committed Feb 3, 2018
commit 2442a11821744a43ff04789bce36d7af28cd06aa
13 changes: 12 additions & 1 deletion lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,19 @@ def _onSize(self, evt):
"""

DEBUG_MSG("_onSize()", 2, self)
sz = self.GetParent().GetSizer()
if sz: si = sz.GetItem(self)
if not sz or not si or (not si.Proportion and not si.Flag & wx.EXPAND):
# not managed by a sizer at all or with a constant size
size = self.GetMinSize()
else:
# variable size, managed by a wx.Sizer
size = self.GetClientSize()
if getattr(self, "_width", None) and size==(self._width,self._height):
# no change in size
return
self._width, self._height = size
# Create a new, correctly sized bitmap
self._width, self._height = self.GetClientSize()
self.bitmap = wxc.EmptyBitmap(self._width, self._height)

self._isDrawn = False
Expand Down