Jeff Fein-Worton wrote:
Hello. I have stumbled upon a rather subtle bug, very similar to this one:
http://lists.wxwidgets.org/pipermail/wxpython-users/2005-June/039821.html
in wxPython 2.8.4.0 <http://2.8.4.0> running only in OS X.
This bug causes a ListCtrl within a GridBagSizer to expand no matter
what direction the window is resized in, thus make the window wider and
wider. It only happens if you have a Frame with a GridBagSizer in it,
and that GridBagSizer has a ListCtrl in it (with EXPAND set for the cell
the list is added to), and the GridBagSizer has an hgap of greater
than 1. It only happens for ListCtrls (or derivatives thereof).
It can also happen for other widgets that don’t have a good GetBestSize
method. The default implementation will first check for a sizer
(wx.ListCtrl doesn’t have it’s own) then will check for children and use
a value that can contain the children, then it will check for a min
size, and then it will just give up and use the current size. On Mac
the check for children sizes doesn’t work right because of how the
generic control is embedded in what could be used as a native control
(IIUC) and so it finally gets to the last condition which is using the
current size as the best size. Since the sizer in your case is
expanding the listctrl to fit the cell then the best size is changing
too, and when the sizer wants to later shrink it then it is not able to
because the best size thinks that it should stay at its current size.
So the easy workaround for this is to simply set an explicit min size.
self.result_list.SetMinSize((200,100))
–
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin,
Thanks–it worked like a charm. And thanks for wxPython, while I’m at it–excellent work.
-Jeff