| FAQ Index - Search - Recent Changes - Everything - Add entry |
13.5. How do I create my own custom TreeModel.
By subclassing GenericTreeModel and implementing the "on_*" methods (e.g. on_get_iter(path) ) of GenericTreeModel. A simple example, treemodel.py, implementing all the required methods of the TreeModel, is included in the pygtk distribution in the examples/pygtk-demos/demos directory: [git.gnome.org]
Some other examples making use of GenericTreeModel:
- Michele Campeot's filesystem viewer: [www.micampe.it]
- NamespaceModel from Arjan Molena's gaphor (in gaphor/ui/namespace.py): [gaphor.sourceforge.net]
- The GTK TreeModel is very similar to the TreeModel class from Java Swing: [java.sun.com]
