wxTreeItemData bug wxPython?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Krzysztof Kaczkowski

    wxTreeItemData bug wxPython?

    Hello
    Im having problem, my class inherit in wxTreeItemData.
    (Python2.3 i wxPython2.4.1.2 u)

    class MyTreeItemData (wxTreeItemData ):
    def __init__(self, name):
    wxTreeItemData. __init__(self)
    self.name_key = name
    def TEST():
    pass

    part my class MywxListCtrl inherit in wxListCtrl:

    item_data = MyTreeItemData( 'Test')
    itm = self.AppendItem (a1, a2, -1,-1,item_data)
    print dir(self.GetIte mData(itm))

    and my problem:
    Function dir(self.GetIte mData(itm)) not list MyTreeItemData, MyTreeItemData
    not assign, dir(...) list only default class wxTreeItemData why?
    [color=blue]
    > print dir(self.GetIte mData(itm))[/color]
    ['Destroy', 'GetClassName', 'GetData', 'GetId', 'SetData', 'SetId',
    '__doc__', '__init__', '__module__', '__repr__', 'this', 'thisown']

    [color=blue]
    >print dir(item_data)[/color]
    ['Destroy', 'GetClassName', 'GetData', 'GetId', 'SetData', 'SetId', 'TEST',
    '__doc__', '__init__', '__module__', '__repr__', 'name_key', 'this',
    'thisown']

    Thank you.


  • Tim Roberts

    #2
    Re: wxTreeCtrl not wxListCtrl

    "Krzysztof Kaczkowski" <krzysztof@py14 2.wroclaw.sdi.t pnet.pl> wrote:[color=blue]
    >
    >Hello
    >Im having problem, my class inherit in wxTreeItemData.
    >(Python2.3 i wxPython2.4.1.2 u)[/color]

    That's not the correct way to use wxTreeItemData. You need to send an
    actual instance of wxTreeItemData to AppendItem, but you can pass an
    arbitrary Python object as a parameter to the constructor. Then you can
    use GetData() to fetch that object.

    Check out the pyTree.py demonstration in the wxPython "demo" directory.
    --
    - Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    Working...