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

Skip to content

Commit de1e1f1

Browse files
authored
Merge pull request #10377 from DietmarSchwertberger/BACKENDWX_FIXEDSIZE
FIX: FigureCanvasWx/Agg fixed size
2 parents a409c01 + d48114e commit de1e1f1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,21 @@ def _onSize(self, evt):
948948
"""
949949

950950
DEBUG_MSG("_onSize()", 2, self)
951+
sz = self.GetParent().GetSizer()
952+
if sz:
953+
si = sz.GetItem(self)
954+
if sz and si and not si.Proportion and not si.Flag & wx.EXPAND:
955+
# managed by a sizer, but with a fixed size
956+
size = self.GetMinSize()
957+
else:
958+
# variable size
959+
size = self.GetClientSize()
960+
if getattr(self, "_width", None):
961+
if size == (self._width, self._height):
962+
# no change in size
963+
return
964+
self._width, self._height = size
951965
# Create a new, correctly sized bitmap
952-
self._width, self._height = self.GetClientSize()
953966
self.bitmap = wxc.EmptyBitmap(self._width, self._height)
954967

955968
self._isDrawn = False

0 commit comments

Comments
 (0)