wxWidgets require color in byte(0-255) format. Is there any way to pass the color in float(0-1) format without converting it into byte one.
Anything in wx to do this conversion vice versa.
Regards
Prashant
wxWidgets require color in byte(0-255) format. Is there any way to pass the color in float(0-1) format without converting it into byte one.
Anything in wx to do this conversion vice versa.
Regards
Prashant
you can use python’s colorsys module for all sorts of transformations.
here is a sample helper function that takes a string describing the color in HSB format and turns it into #RRGGBB that wx knows to interpret.
def HSBtoRGB(hsb):
“”" hsb format: angle(hue).saturation.brightness"“”
h,s, b = map(int, hsb.split(“.”))
return “#”+“”.join([hex(int(x*255))[2:] for x in colorsys.hsv_to_rgb(h/360., s/100., b/100.)])
Peter
On Fri, Aug 8, 2008 at 12:17 PM, Prashant Saxena animator333@yahoo.com wrote:
wxWidgets require color in byte(0-255) format. Is there any way to pass the color in float(0-1) format without converting it into byte one.
Anything in wx to do this conversion vice versa.
Regards
Prashant
wxpython-users mailing list
–
There is NO FATE, we are the creators.