Omar Kilani wrote:

Hello,

I was wondering if someone could advise on a way of doing conditional
colouring of cells. Say I have:

-----|------|
one | four |
-----|------|
two | five |
-----|------|
three| six |

And I wanted to give each cell a different colour (based on its contents
or cell data.) How would I do it?

CellRendererText seems to apply the background/foreground colours to the
whole column.

Do I need to implement my own cell renderer?

I may be able to do it with treeview.get_cell_area, but I'm not sure how
to pass in the GdkRectangle argument.

Simply create a column in your model of type string which contains the colour you want for the cell. Then when setting up the tree view column, map that column to the "cell_foreground" or "cell_background" properties of the cell renderer.

James.

--
Email: [EMAIL PROTECTED] | Linux.conf.au http://linux.conf.au/
WWW: http://www.daa.com.au/~james/ | Jan 22-25 Perth, Western Australia.


_______________________________________________
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