From: Alex T. <al...@tw...> - 2005-04-11 20:53:50
|
Liam Clarke wrote: > Hello again, > > Feeling kind of silly, just looked more closely at MCL, and found > lines 330-338 under the method > _setColumnHeadings(self, aList): > > elif w == 3 and \ > isinstance(aList[0][0], StringType) and \ > isinstance(aList[0][1], IntType) and \ > isinstance(aList[0][2], IntType): > flag = 0 > for i in xrange(numcols): > if aList[i][1] != wx.LIST_AUTOSIZE: > flag = 1 > self.InsertColumn(i, aList[i][0], > format=aList[i][2], width=aList[i][1]) > > So, I get the feeling that if I create my ColumnHeadings as a list of > [ "Column name", x, y] > where x and y are both integers, then it'll come through to this > InsertColumn method... > > But, what values are legitimate values? If x and y have to be ints, > how does that fit in with InsertColumn? I'm used to wx.LIST_AUTOSIZE > and so forth. There's a hint in the sample/multicolumnexample.py in the comments at the head. Playing around a bit with that, I think you pass in a list like [ ["header", width, format], ...] width is an integer value : -1 = auto_size positive value is an actual column width (note you must have ALL columns set to auto_size to get autosizing) format is one of wxLIST_FORMAT_LEFT : 0 wxLIST_FORMAT_RIGHT : 1 wxLIST_FORMAT_CENTRE : 2 Here's a snippet from my "play" code version of multicolumnexample.py (from on_loadButton_mouseClick I changed > self.components.theList.columnHeadings = items[0] > self.components.theList.items = items[1:] to > self.components.theList.columnHeadings = items[0] > headings = self.components.theList.GetColumnHeadingInfo() > print "here with", headings > headings[0][1] = 80 > headings[1][2] = 1 -- try various values here > self.components.theList.columnHeadings = headings > headings = self.components.theList.GetColumnHeadingInfo() > print "and now", headings > self.components.theList.items = items[1:] > P.S. I couldn't figure out the right way to use the wxLIST_FORMAT_* constants. I'm sure you should be able to do something like import wx and then use wx.wxLIST_FORMAT_LEFT but that didn't work - I finished up doing import wx print wx._controls.wxLIST_FORMAT_LEFT to check what the values were. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.5 - Release Date: 07/04/2005 |