I've figured out how to use many of the widgets in the 2.0.0 release of pygtk, 
but I've spent the last several hours trying to make sense of the TreeModel. 
Call me thick, but I don't see where some of the methods are originating, or 
why  they are being called.  Why did I have to define the 20 some methods in 
the class that inherited from GenericTreeModel? I've studied treemodel.py, 
but I still don't get it. If I delete on_iter_children I get the following 
error.

        AttributeError: on_iter_children
        None

Some experimenting found that the following code will call on_iter_children:

def f(a,b,c):
    print "  nodes: ", b,c

p = MyModel()
p.foreach(f)

Why this is happening isn't clear. I found no references to on_iter_children 
in the pygtk source code.  It shows up in a couple binary files that are 
built, but that, and in the example are the only references. 

My goal is to populate a TreeModel with an XML tree. So far I've had no luck 
in getting started.  I suspect that others on this list would really love to 
see an example that shows how to tie a XML DOM tree to the TreeModel.  (An 
example that displayed a .glade file would be most helpful.) The example 
treemode.py is confusing because the path is also the content that is 
displayed in the tree. Does the path have to be a tuple? It isn't clear how 
the tree is initially populated.

BTW, thanks for all the great work on pyGtk. Now if I could only figure out 
how to use it:-)


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to