Skip to content

FigureCanvasWx/Agg fixed size #10377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2018
Merged
Changes from all commits
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
15 changes: 14 additions & 1 deletion lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,21 @@ def _onSize(self, evt):
"""

DEBUG_MSG("_onSize()", 2, self)
sz = self.GetParent().GetSizer()
if sz:
si = sz.GetItem(self)
if sz and si and not si.Proportion and not si.Flag & wx.EXPAND:
# managed by a sizer, but with a fixed size
size = self.GetMinSize()
else:
# variable size
size = self.GetClientSize()
if getattr(self, "_width", None):
if 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