[pygtk] TreeView - Making whole row colored, Again
John Finlay
finlay at moeraki.com
Thu Dec 11 05:33:29 WST 2008
Kevin wrote:
> Greetings,
>
> I came across an old message in the archives at http://www.mail-archive.com/pygtk@daa.com.au/msg15480.html , which sounds a lot like I want to do (though I want to work with background colors rather than foreground colors). But I was thinking: couldn't I just add a column to my model containing the color values I want for each row, and use values of #ffffff for all the rows I wanted to leave white?
>
> The problem is that without a column of booleans, I can't seem to set the background-set property of the columns. Specifically, I'm using:
>
> leftjust = gtk.CellRendererText()
> column = gtk.TreeViewColumn('Filename', leftjust, text=COLUMN_FILENAME)
> column.set_sort_column_id(COLUMN_FILENAME)
> treeview.append_column(column)
>
> column.add_attribute(leftjust, 'background-set', True)
>
remove the above line.
> column.add_attribute(leftjust, 'background', COLUMN_FLAG)
>
> but when I run the program, I keep getting
> Warning: unable to set property `background-set' of type `gboolean' from value of type `gchararray'
>
> Is there really no way of doing this without creating another column of booleans?
>
>
You don't have to set "background-set" - it's set automatically when
"background" is set.
John
More information about the pygtk
mailing list