I have a PyGtk treeview with a couple of columns. During runtime i add constantly new rows. Each cell contains a string. Normaly, i would use a gtk.CellRenderer
for each row, but I want to set the background color of each cell, according to the value inside the cell.
I tried a couple of solutions, but it seems that I have to create a CellRenderer
for each cell, set the text attribute and the background color. This seems a little oversized, so i asked myself if there is a nicer solution for the problem. Any suggestions?
You can define background and foreground for your treeview cells in extra fields of the treeview data source. Then setup foreground and background attributes for the treeview columns to get their values from the corresponding data source fields.
Below is a small example:
hope this helps, regards