SetItemData example

Hi, Robin et al,
I have a quick question: how do I implement 'wxPyTreeItemData *'?

There is no such thing in the TreeListCtrl demo, google search does
not give too many
examples and for people new to wxPython it might be hard to understand.
Moreover, I tried to simply pass the tuple as the item data and got
the exception
that I have to use this class pointer.

Can someone give me a hint on how do I use this feature?

I just have a tuple as (id = 1, offset = 63, size = 12345, date =
'2014-05-28') and want to
use this tuple as a client data on the TreeListCtrl item.

Thank you.

One more thing:

I tried to implement such class but getting an error, either:

"name is not defined".

or

"Type Error: in method 'TreeListCtrl_SetItemData', expected argument 3
of type 'wxPyTreeItemData *'"

So what is the proper way defining that class to pass to the
SetItemData() function?

Thank you.

···

On Sun, May 25, 2014 at 6:22 PM, Igor Korot <ikorot01@gmail.com> wrote:

Hi, Robin et al,
I have a quick question: how do I implement 'wxPyTreeItemData *'?

There is no such thing in the TreeListCtrl demo, google search does
not give too many
examples and for people new to wxPython it might be hard to understand.
Moreover, I tried to simply pass the tuple as the item data and got
the exception
that I have to use this class pointer.

Can someone give me a hint on how do I use this feature?

I just have a tuple as (id = 1, offset = 63, size = 12345, date =
'2014-05-28') and want to
use this tuple as a client data on the TreeListCtrl item.

Thank you.

Igor Korot wrote:

Hi, Robin et al,
I have a quick question: how do I implement 'wxPyTreeItemData *'?

There is no such thing in the TreeListCtrl demo, google search does
not give too many examples and for people new to wxPython it might be hard to understand.
Moreover, I tried to simply pass the tuple as the item data and got the exception
that I have to use this class pointer.

Can someone give me a hint on how do I use this feature?

SetItemData calls the raw API, which stores an integer. You want
SetItemPyData (also called SetPyData), which stores a Python object.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.