[pygtk] TreeView - Making whole row colored, Again

Kevin kehander at yahoo.com
Tue Dec 9 07:34:35 WST 2008


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)
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?

Thanks, K.



      __________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com



More information about the pygtk mailing list