[wxPython] wxSizer::SetMinSize?

I had a similar problem, and Robin's suggestion didn't work for me. This is
because what I was trying for was a panel containing sizers that will expand and
contract, but when contracted past the set minimum will become scrollable. Here
is my current solution - it's not as pretty as I'd like, but it works pretty
well.

Step 1: remove "self.SetAutoLayout(true)" from your panel (you'll handle that
yourself, see Step 3)
Step 2: the example code assumes that you have a sizer that holds all others
called 'self.topSizer', so be sure and set that. It also assumes that you save
the minimim size in a variable called 'self.minSize'. Here is the code I use
for that (these are the last few lines in my derived panel's __init__()):
  self.SetSizer(topSizer)
  self.minSize = topSizer.GetMinSize()
  topSizer.Fit(self)
  topSizer.SetSizeHints(self)
Step 3: Derive your panel from _ScrollPanel (or a some suitable variation)
[ class _ScrollPanel is at the end of this message ]]

This works well for me; the only remaining problem is that sometimes controls
that move when the scrolled panel expand or contract aren't painted properly,
but I don't think that has anything to do with the sizers. I know I should have
passed the minimum size and the sizer to _ScrollPanel.__init__(), but I didn't.
Any improvements on this code are welcome; I hope it is of use to someone.

    /cco

class _ScrollPanel(wxScrolledWindow):
def __init__(self, parent):
  wxScrolledWindow.__init__(self, parent, -1, wxPoint(0, 0),
    wxDefaultSize, wxRAISED_BORDER | wxCLIP_CHILDREN)
  self.minSize = wxDefaultSize
  self.topSizer = None

def OnSize(self, event):
  sx = 0
  sy = 0
  newSize = event.GetSize()
  width = newSize.width
  height = newSize.height

  if width < self.minSize.width:
   sx = -1
   width = self.minSize.width

  if height < self.minSize.height:
   sy = -1
   height = self.minSize.height

  self.Scroll(sx, sy)
  self.topSizer.SetDimension(0,0,width,height)
  event.Skip()