find item in wx.TreeListCtrl by pydata code snippet

Discussion in 'Python' started by Johannes Lochmann, Aug 18, 2006.

  1. Hello list,

    here is a small code snippet to recursively search a wx.TreeListCtrl for an
    item with specific pydata.

    Feel free to comment!


    def recursiveFindItemByPydata(self, parent, pydata):
        item, cookie = self.GetFirstChild(parent)
        while item:
            if self.GetPyData(item) == pydata:
                    return item
                                   
            if self.ItemHasChildren(item):
                found = self.recursiveFindItemByPydata(item, pydata)
                if found is not None:
                    return found
                 
            item, cookie = self.GetNextChild(parent, cookie)
        return None

    HAND

    Johannes
     
    Johannes Lochmann, Aug 18, 2006
    #1
    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. sendhil kumar

    TreeCtrl to TreeListCtrl

    sendhil kumar, May 27, 2006, in forum: Python
    Replies:
    0
    Views:
    1,409
    sendhil kumar
    May 27, 2006
  2. Frank Niessink

    Re: TreeCtrl to TreeListCtrl

    Frank Niessink, Jun 5, 2006, in forum: Python
    Replies:
    0
    Views:
    425
    Frank Niessink
    Jun 5, 2006
  3. Johannes Lochmann

    crash in wx.TreeListCtrl SelectItem()

    Johannes Lochmann, Aug 18, 2006, in forum: Python
    Replies:
    1
    Views:
    363
    jean-michel bain-cornu
    Aug 18, 2006
  4. entrepreneur
    Replies:
    3
    Views:
    405
    Martin Steen
    Oct 24, 2006
  5. Replies:
    19
    Views:
    554
    Alf P. Steinbach
    Jan 30, 2008
Loading...

Share This Page