On Wed, Jul 07, 2004 at 01:13:28AM +0000, Christian Bird wrote:
> I've got a question about the best way to iterate over the items in a
> TreeView starting with an arbitrary item in the treeview. I'm trying
#untested back-of-the-envelope coding!
#Uses the gtk standard of returning False on match.
def search_func(model, col, key, iter, user_data):
value = model.get_value(iter, col)
return value!=key
def search(model, col, key, iter, search_func, user_data):
if search_func(model, col, key, iter, user_data):
for i in range(model.iter_n_children()):
child = model.iter_nth_child(i)
search(model, col, key, child, search_func, user_data)
else:
yeild iter
mysearch = search(model, 0, 'foobar', it, search_func)
matches = list(mysearch)
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/