And this is on OS 10.9, Python 2.7.6. wxPython 3.0 has the same issue (I just don’t have it on this particular computer at the moment).
The attached standalone example should be sufficient to demonstrate the problem: when the inner panel is resized as the painted contents change, the scrolled panel enclosing it does not resize as well. Even calling SetVirtualSize() doesn’t work. I call this a “possible” regression because it worked fine in 2.9.4.1 (and I’m pretty certain it worked on other platforms in 2.8), but it’s not clear if I’m doing something wrong and just got lucky with the older versions. For what it’s worth, wx.lib.scrolledpanel itself does not appear to have changed at all, so presumably this is the result of a lower-level change, but I don’t know where to begin looking.
thanks,
Nat
(PS. I realize that the sizer manipulation in DrawFrame.OnDraw may be overkill; I wasn’t sure which commands were really necessary, but I’ve tried every combination and none of them work.)
And this is on OS 10.9, Python 2.7.6. wxPython 3.0 has the same issue
(I just don't have it on this particular computer at the moment).
The attached standalone example should be sufficient to demonstrate the
problem: when the inner panel is resized as the painted contents change,
the scrolled panel enclosing it does not resize as well. Even calling
SetVirtualSize() doesn't work. I call this a "possible" regression
because it worked fine in 2.9.4.1 (and I'm pretty certain it worked on
other platforms in 2.8), but it's not clear if I'm doing something wrong
and just got lucky with the older versions. For what it's worth,
wx.lib.scrolledpanel itself does not appear to have changed at all, so
presumably this is the result of a lower-level change, but I don't know
where to begin looking.
The calculated best size of a window is normally cached since the calculation can sometimes be expensive. So when you do something that could change the best size of a window you should call InvalidateBestSize so DoGetBestSize will be called again the next time the sizer wants to do a layout.
def SetDrawLines (self, n) :
self._lines_drawn = n
self.InvalidateBestSize()
Thanks, that did indeed fix the problem with the actual app.
-Nat
···
On Wed, Jan 15, 2014 at 6:47 PM, Robin Dunn <robin@alldunn.com> wrote:
The calculated best size of a window is normally cached since the
calculation can sometimes be expensive. So when you do something that
could change the best size of a window you should call InvalidateBestSize
so DoGetBestSize will be called again the next time the sizer wants to do a
layout.
def SetDrawLines (self, n) :
self._lines_drawn = n
self.InvalidateBestSize()