Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > find item in wx.TreeListCtrl by pydata code snippet

Reply
Thread Tools

find item in wx.TreeListCtrl by pydata code snippet

 
 
Johannes Lochmann
Guest
Posts: n/a
 
      08-18-2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory Leaks - Can you help me find them in ths snippet nmehring@gmail.com C++ 19 01-30-2008 10:38 AM
a snippet of c++ code, i can't find the error? entrepreneur C++ 3 10-24-2006 03:50 PM
Code snippets, tool to convert basic to .snippet xml? Edwin Knoppert ASP .Net 0 11-30-2005 03:45 PM
Is there a code snippet showing how to do a Redirect on a TreeView event Tom ASP .Net 3 12-01-2004 03:04 AM
How can I save my code snippet on toolbox in vs.net? Clare Hsiao ASP .Net 0 02-12-2004 02:01 AM



Advertisments