From: Liam C. <cy...@gm...> - 2005-04-11 23:38:23
|
Hi Alex,=20 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 =3D 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 On Apr 12, 2005 8:53 AM, Alex Tweedly <al...@tw...> wrote: >=20 > Liam Clarke wrote: >=20 > > 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 =3D=3D 3 and \ > > isinstance(aList[0][0], StringType) and \ > > isinstance(aList[0][1], IntType) and \ > > isinstance(aList[0][2], IntType): > > flag =3D 0 > > for i in xrange(numcols): > > if aList[i][1] !=3D wx.LIST_AUTOSIZE: > > flag =3D 1 > > self.InsertColumn(i, aList[i][0], > > format=3DaList[i][2], width=3DaList[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. >=20 > 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 =3D auto_size > positive value is an actual column width > (note you must have ALL columns set to auto_size to get autosizing) >=20 > format is one of > wxLIST_FORMAT_LEFT : 0 > wxLIST_FORMAT_RIGHT : 1 > wxLIST_FORMAT_CENTRE : 2 >=20 > Here's a snippet from my "play" code version of multicolumnexample.py > (from on_loadButton_mouseClick >=20 > I changed >=20 > > self.components.theList.columnHeadings =3D items[0] > > self.components.theList.items =3D items[1:] >=20 > to >=20 > > self.components.theList.columnHeadings =3D items[0] > > headings =3D self.components.theList.GetColumnHeadingInfo() > > print "here with", headings > > headings[0][1] =3D 80 > > headings[1][2] =3D 1 -- try various values here > > self.components.theList.columnHeadings =3D headings > > headings =3D self.components.theList.GetColumnHeadingInfo() > > print "and now", headings > > self.components.theList.items =3D items[1:] > > >=20 > 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. >=20 >=20 > -- > Alex Tweedly http://www.tweedly.net >=20 > -- > 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 >=20 >=20 Of course.... I should've tried -1... thanks for that Alex. Regards,=20 Liam Clarke --=20 'There is only one basic human right, and that is to do as you damn well=20 please. And with it comes the only basic human duty, to take the consequences.' |