[pygtk] TreeView background-color in a row

Rafael Villar Burke pachi at rvburke.com
Tue Oct 24 01:20:25 WST 2006

Volker Helm wrote:
> Hi,
> I'm looking for a possibility to change the color of a row in a TreeView.
> I looked through the tutorial and the reference, but I couldn't understand how I can change the background-color for one cell or a complete row.
> In the tutorial is an example, but I didn't get the meaning of it.
> As I understand, you define a "renderer" and asign it to a TreeViewColumn. But how can you change the renderer for one cell or a complete row.
You'd need to have a new (not visible) column in your model that will be
the source for the background-color property. You'd have to create each
cell renderer (probably you have one per column) so as it takes the
background-color property from the new column number.
To wrap up... the background color is like any other data (like text)
the cellrenderer takes and it comes from a column in the model.

Hope this helps,

Rafael Villar Burke

More information about the pygtk mailing list