[wxPython-users] SetItemData error

jonhattan jonhattan at faita.net
Mon Dec 24 06:17:19 PST 2007


Donn Ingle escribió:
> Hi again,
>  Been trying the old "sort a ListCtrl" using collation thing and I can't get
> off the ground. It's been at least 1 year since I last asked about this
> here and I have not had time since then to get back on to it.
>
> I am keeping a internal dict (d) to link text to id numbers. I want to use
> the id in the SetItemData so that SortItem will access it. I can't get past
> this however:
>
> for i in somelistofstrings:
>         id = wx.NewId()
>         self.d[id] = i
>         li = wx.ListItem()
>         li.SetText ( i )
>         self.InsertItem( li )
>         self.SetItemData( li, long(id) )
>
>   
the first arg to SetItemData is the return value of InsertItem:

row = self.InsertItem( li )
self.SetItemData( row, long(id) )



--jonhattan


>  
> File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
> line 4553, in SetItemData
>     return _controls_.ListCtrl_SetItemData(*args, **kwargs)
> TypeError: in method 'ListCtrl_SetItemData', expected argument 2 of
> type 'long'
>
> eh?
> \d
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
>   




More information about the wxpython-users mailing list