[pygtk] Make the TreeView widget look different (like in Transmission)

Walter Leibbrandt walter at translate.org.za
Mon Jul 27 18:05:22 WST 2009

Op 27/07/2009 09:09, ivanko.rus het geskryf:
> Hello everybody! I am making a little app here, it should be a front-end for
> mencoder and I'd like to have the file list looking like Transmission's
> (BitTorrent client) file list. So, my question is - is there a way to do
> that using PyGTK? Thanks in advance, I'll be grateful for any help!

Good news: It's definitely possible.
Bad news: It's not easy and may become messy.

The way to achive this is by creating a custom cell renderer or by using 
more than one of the standard cell renderers.

Using multiple cell renderers has the disadvantage of only being 
rendered horizontally next to each other. I am not aware of any way to 
change this behaviour (but would be glad if someone else can point it out).

Using custom cell renderers, there are, again, two options:
* Create a cell renderer that will custom-render the entire layout. In 
an attempt to achive a generic solution to this problem, I've created a 
CellRendererWidget that renders an arbitrary widget (meant to be a 
container), but it's not entirely stable. If you're interested, you can 
get the source at 
* Create a cell renderer that combines various other renderers. This 
seems to be a cleaner way (as well as Transmission's way) of doing 
things. Looking at lines 537-544 of 
(the business end of the render_minimal() function), you can see that 
the 4 wrapped cell renderers' rendering functions are simply called with 
modified areas.

Walter Leibbrandt                  Software Developer
Recent blogs:
* Conquering the CellRendererWidget

More information about the pygtk mailing list