I am drawing on drawing area using cairo in pygtk. I set color of line using this func:
cr.set_source_rgb(203,12,41)
but it showing white color instead of this color #CB0C33
it is like red rose color.
So please can any one tell me how to change开发者_Python百科 color of line to any color using cairo in pygtk.
Please help me.
thank you in advanced...
set_source_rgb expects you to pass floating point values from 0 to 1, where 1 should correspond to FF. Pls, check if the code below would work for you:
color = gtk.gdk.Color('#CB0C33')
cr.set_source_rgb(float(color.red) / 65535,
float(color.green) / 65535,
float(color.blue) / 65535)
hope this helps, regards
精彩评论