[pygtk] cell.set_property and colors - SOLVED
Alessandro Dentella
sandro at e-den.it
Wed Oct 1 22:53:29 WST 2008
On Thu, Sep 25, 2008 at 05:48:54PM +0200, Alessandro Dentella wrote:
> Hi,
>
> I want to color single cells in a TreeView (totals of a table).
> Since I'm using cell_data_func to set value of property text I tried
> using that same function to set colors but it turns out all cells get
> colored...
>
> def dict_cell_data_func(self, column, cell, model, iter, (col_num, name)):
> obj = model.get_value(iter, col_num)
> value = getattr(obj, name)
> cell.set_property("text", value)
> if value == 'venice':
> cell.set_property("cell-background", 'yellow')
>
>
> can anybody help me understanding why?
It turns out that if you set 'cell-background' you need to set it in
*any* cell. You can set it to None and it will use the default (that may
happen to be an alternating scheme).
I still don't really udertand if the cell object I'm setting the property is
a unique instance for the whole column (I think so) or one instance each
cell.
sandro
More information about the pygtk
mailing list