From: Ronny De W. <ron...@gm...> - 2005-03-09 20:25:05
|
Kevin Altis <altis <at> semi-retired.com> writes: > > On Feb 23, 2005, at 11:19 PM, ronny de winter wrote: > > > I would expect the columwidth for the column in a MultiColumnList are > > automatically > > sized to the size of the longest item in the column. > > This doesn't seem to happen always. > > > > Double clicking in the header line on the border of the colums does > > the job. > > Any ideas on how to automate this so that it happens on initialisation > > and on any > > update of the list ? > > > > Ronny De Winter > > > > I don't know. If that is part of the behavior of the native control and > doesn't involve calling one of the methods then I'm not even sure where > to look. You might need to bring this up on wxPython-users or look more > deeply into the multicolumnlist.py component. > > ka > After some more digging i found a way to do it: import wx def on_initialize(self, event): self.components.thelist.columnHeadings = dat.headings self.components.thelist.items = dat.values() self.autoSizeColumns() self.updating = False def autoSizeColumns(self): for col in range(len(dat.headings)): self.components.thelist.SetColumnWidth(col, wx.LIST_AUTOSIZE) and call this on any update of thelist. I wonder if i can do it in one central place. Cheers, Ronny |