[pygtk] TreeView fun.

John Finlay finlay at moeraki.com
Fri Aug 6 08:46:47 WST 2004

dave wrote:

> So I just finished going through the treeview documentation and 
> tutorials, and I'm a little confused (not uncommon for me). My goal is 
> to do two things:
> 1. Have each line in the treeview connected to an object and let the 
> object tell the treeview what to display, and when it needs to update 
> the display.
> 2. Optionally also somehow have some of the lines have icons as well 
> as text. (The texts make references to "HBOX-like capabilities" - but 
> I don't see any way of packing arbitrary widgets into the cell render 
> (i.e. a text widget and a icon).)
> Does anyone have a quick hint?
For question 1 the normal case is to populate a TreeModel (ususally a 
ListStore or a TreeStore) with data that is displayed automatically by 
the TreeView using TreeviewColumns packed with CellRenderers. THe data 
could be an object reference. I don't know if you have seen the PyGTK 2 
tutorial but the following chapter tries to describe the relationship 
and use of these objects:


For question 2 you should be able to get some info on this in:


If this tutorial chapter is not helpful please let me know how you think 
it could be improved.


More information about the pygtk mailing list