Rob Brown-Bayliss wrote:

>Hi,
>
>Can some one give me a quick demo if placing a pixmaps in a treeview,
>preferable different pixmaps on each line...
>
The basic idea is that you add a column to your model of type 
gtk.gdk.Pixbuf, and put pixbuf objects in that column for all the rows 
in your tree (you can also assign the same pixbuf to multiple rows in 
the tree if you want).

Then you create a tree view column using gtk.CellRendererPixbuf as the 
the cell renderer, and map the pixbuf column in your model to the 
"pixbuf" property for the cell renderer (similar to how you would set 
the "text" property on a text cell).  There are also 
"pixbuf_expander_open" and "pixbuf_expander_closed" properties if you 
want different images depending on the state of the node.

>
>Also, more on trees, is it possible totell which column and row a user
>has clicked on...
>
The treeviewcolumn is passed in to the "row_activated" signal if that is 
what you are using.  Alternatively, if you are connecting to the 
"button_press_event" signal, you can use treeview.get_path_at_pos() to 
find the tree path and tree column where the user clicked.

James.

-- 
Email: [EMAIL PROTECTED]              | Linux.conf.au 2003 Call for Papers out
WWW:   http://www.daa.com.au/~james/ |   http://conf.linux.org.au/cfp.html



_______________________________________________
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