[gcompris-devel] how to add alpha to rgb color

Fionn Ziegler fionnziegler at gmail.com
Mon Aug 23 02:49:36 UTC 2010


Hi,
I have a gtk.ColorButton() and I want to draw a goocanvas line with the
selected color (I need a 32 bit rgba color). My problem how to get the rgba
color-code of the rgb color. Here my test code:
                print "gtk.gdk.Color->to_string: %s" % (color.to_string())
                print "gtk.gdk.Color: %s" % (color)
                print "self.colorpicker.get_alpha(): %s " %
(self.colorpicker.get_alpha())
output black:
gtk.gdk.Color->to_string: #000000000000
gtk.gdk.Color: #000
self.colorpicker.get_alpha(): 65535
output blue:
gtk.gdk.Color->to_string: #28b2229eca30
gtk.gdk.Color: #28b2229eca30
self.colorpicker.get_alpha(): 65535

how to get a rgba code like this:*
self.rgba_colors['line'] = 0xFFFF40FF*

sorry maybe there is a lack of basic knowlegde but I have no idea how to do
this,


Thanks for any help,

Fionn Ziegler



More information about the Gcompris-devel mailing list