find item in wx.TreeListCtrl by pydata code snippet

J

Johannes Lochmann

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top