def setWidgetValue(self, value): type_ = type(value) alpha = 0xFFFF if type_ is str: color = gtk.gdk.Color(value) elif (type_ is int) or (type_ is long): red, green, blue, alpha = unpack_color(value) color = gtk.gdk.Color(red, green, blue) elif type_ is gtk.gdk.Color: color = value else: raise TypeError("%r is not something we can convert to a color" % value) self.set_color(color) self.set_alpha(alpha)
def setWidgetValue(self, value): type_ = type(value) alpha = 0xFFFF if type_ is str: color = Gdk.Color(value) elif (type_ is int) or (type_ is long): red, green, blue, alpha = unpack_color(value) color = Gdk.Color(red, green, blue) elif type_ is Gdk.Color: color = value else: raise TypeError("%r is not something we can convert to a color" % value) self.set_color(color) self.set_alpha(alpha)