wxTreeItemData bug wxPython?

Discussion in 'Python' started by Krzysztof Kaczkowski, Aug 21, 2003.

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

    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.GetItemData(itm))

    and my problem:
    Function dir(self.GetItemData(itm)) not list MyTreeItemData, MyTreeItemData
    not assign, dir(...) list only default class wxTreeItemData why?

    > print dir(self.GetItemData(itm))

    ['Destroy', 'GetClassName', 'GetData', 'GetId', 'SetData', 'SetId',
    '__doc__', '__init__', '__module__', '__repr__', 'this', 'thisown']


    >print dir(item_data)

    ['Destroy', 'GetClassName', 'GetData', 'GetId', 'SetData', 'SetId', 'TEST',
    '__doc__', '__init__', '__module__', '__repr__', 'name_key', 'this',
    'thisown']

    Thank you.
     
    Krzysztof Kaczkowski, Aug 21, 2003
    #1
    1. Advertising

  2. Krzysztof Kaczkowski

    Tim Roberts Guest

    Re: wxTreeCtrl not wxListCtrl

    "Krzysztof Kaczkowski" <> wrote:
    >
    >Hello
    >Im having problem, my class inherit in wxTreeItemData.
    >(Python2.3 i wxPython2.4.1.2u)


    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,
    Providenza & Boekelheide, Inc.
     
    Tim Roberts, Aug 22, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand
    Replies:
    1
    Views:
    357
    Cliff Wells
    Jul 23, 2003
  2. ulysses
    Replies:
    4
    Views:
    768
    Werner Schiendl
    Oct 22, 2003
  3. Logan
    Replies:
    5
    Views:
    765
    David Bolen
    Dec 11, 2003
  4. Ruben Charles
    Replies:
    6
    Views:
    501
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Oct 25, 2005
  5. Robin Dunn
    Replies:
    0
    Views:
    519
    Robin Dunn
    Mar 28, 2006
Loading...

Share This Page