Nesting object to a row in a wx.ListCtrl

Hi there,

I've a wx.ListCtrl and a list of object, say a list of "Person" objects. I would like to add the single object to a row of a wx.ListCtrl and show only a set of attributes.

In this way when i select one or more rows i would like to retrieve the object inside of the rows not the strings.

It seems simple but i would like to preserve sorting of the wx.ListCtrl; is there a way to do it ? Probably i have to subclass the wx.ListCtrl, is there an example ?

Here a sample code of how it could work:
listCtrl.bind('name')
listCtrl.bind('surname')
listCtrl.appendRows(listOfPersonObjects)

In this way i show only two columns with name and surname.

and with:
listCtrl.GetSelectedObjects()

i retrieve the person object that the user has selected.

Thanks

Hello,

These may be helpful:

http://wiki.wxpython.org/ListControls
http://objectlistview.sourceforge.net/python/

···

On Nov 1, 2008, at 1:59 PM, gioacchinomauri@libero.it wrote:

Hi there,

I've a wx.ListCtrl and a list of object, say a list of "Person" objects. I would like to add the single object to a row of a wx.ListCtrl and show only a set of attributes.

In this way when i select one or more rows i would like to retrieve the object inside of the rows not the strings.

It seems simple but i would like to preserve sorting of the wx.ListCtrl; is there a way to do it ? Probably i have to subclass the wx.ListCtrl, is there an example ?

Here a sample code of how it could work:
listCtrl.bind('name')
listCtrl.bind('surname')
listCtrl.appendRows(listOfPersonObjects)

In this way i show only two columns with name and surname.

and with:
listCtrl.GetSelectedObjects()

i retrieve the person object that the user has selected.

Thanks

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

What you are looking for is the wonderful ObjectListView, by Phillip Piper:

http://objectlistview.sourceforge.net/python/

···

On Sat, Nov 1, 2008 at 2:59 PM, gioacchinomauri@libero.it <gioacchinomauri@libero.it> wrote:

Hi there,

I've a wx.ListCtrl and a list of object, say a list of "Person" objects. I would like to add the single object to a row of a wx.ListCtrl and show only a set of attributes.

--
Best Regards,
Michael Moriarity