[pygtk] convert r,g,b color definition is a color name
awalter1
alain.walter at thalesgroup.com
Wed Oct 24 15:30:18 WST 2007
I've found the solution
First of all, the column containing the color in the ListStore have to be
changed from str to gtk.gdk.Color.
Then put the color in the column as follows:
cmap = self.win.get_colormap() # get any widget, just to have the
current colormap
color = cmap.alloc_color(r,g,b)
put the color in the related column in the ListStore.
that 's hit.
awalter1 wrote:
>
> Hi,
> I am using the following method to modify color on a cell of a treeview:
> tvcolumn = gtk.TreeViewColumn(title,cell,text=indx,background=col)
> where col contains the color name to be used as 'red', 'green', ...
> It works fine.
>
> However, colors of my application are coming from gtk.ColorButton(). Thus
> I get colours defined by r,g,b. then 3 values
>
> I see 2 possibilities:
> 1- I convert my r,g,b definition into a colour name
> 2- the interface of gtk.TreeViewColumn allows to specify a column with
> r,g,b definition.
>
> For the time being, I have no idea to do one or the other.
>
> Thanks
>
--
View this message in context: http://www.nabble.com/convert-r%2Cg%2Cb-color-definition-is-a-color-name-tf4678103.html#a13380476
Sent from the Gtk+ - Python mailing list archive at Nabble.com.
More information about the pygtk
mailing list