Yes, sorry, for some reason I thought this was a known problem. I should have been more specific: it’s fine when using a plain wx.Panel, but when using ScrolledPanel, the ListCtrl will grow with the panel but not shrink - so if I maximize the window and resize it to the original dimensions, I’m still stuck with a massive ListCtrl. Code below. It’s possible I’m just doing something dumb - I never entirely understood how the ScrolledPanel, sizers, and frame interact.
(Python 2.6, wxPython 2.8.10.1, Mac OS 10.6 - and I’ve also seen the same problem on Linux, but I didn’t test the sample app there.)
import wx
import wx.lib.scrolledpanel
class MyFrame (wx.Frame) :
def init (self, *args, **kwds) :
wx.Frame.init(self, *args, **kwds)
panel = wx.lib.scrolledpanel.ScrolledPanel(self)
frame_sizer = wx.BoxSizer(wx.VERTICAL)
frame_sizer.Add(panel, 1, wx.EXPAND)
panel_sizer = wx.BoxSizer(wx.VERTICAL)
panel.SetSizer(panel_sizer)
txt = wx.StaticText(panel, -1, “This is a text widget.”)
panel_sizer.Add(txt, 0, wx.ALL, 5)
listctrl = wx.ListCtrl(panel, -1, size=(600,200))
panel_sizer.Add(listctrl, 1, wx.EXPAND|wx.ALL, 5)
panel_sizer.Fit(panel)
panel.SetupScrolling()
self.Fit()
if name == “main” :
a = wx.App(0)
f = MyFrame(None, title=“Sample”)
f.Show()
a.MainLoop()
···
On Wed, Nov 4, 2009 at 1:59 PM, Robin Dunn robin@alldunn.com wrote:
On 11/3/09 4:37 PM, Nathaniel Echols wrote:
I’m using ListCtrl to display input files and associated metadata.
Unfortunately, I’ve found that using wx.EXPAND when adding a ListCtrl
to a sizer is very buggy, so they all end up with a fixed width.
Could you explain this problem a little more? Perhaps with a small
sample app?