Question

I have a gtkTreeView with this model structure:

Row One

.. Child One

....Grandson On

....Grandson Two

Row Two

..Child One

I need to read each one of this rows.

How can I do?

I'm a new bee in gtk.

Was it helpful?

Solution

I solved my own problem above with this code:

def print_tree_store(store):
    rootiter = store.get_iter_first()
    print_rows(store, rootiter, "")

def print_rows(store, treeiter, indent):
    while treeiter != None:
        print indent + str(store[treeiter][:])
        if store.iter_has_child(treeiter):
            childiter = store.iter_children(treeiter)
            print_rows(store, childiter, indent + "\t")
        treeiter = store.iter_next(treeiter)

Is part of this documentation

Tree and List Widgets

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top