def __changeMode(self, *args):
newMode = self.colorModeVar.get()
if newMode != self.colorModeLocal:
x = self.colorX.get()
y = self.colorY.get()
z = self.colorZ.get()
col=0
if newMode == 0: # HSV->RGB
col = [ int(round(x*255.0)) for x in colorsys.hsv_to_rgb(x/255.0, y/255.0, z/255.0)]
else: # RGB -> HSV
col = [ int(round(x*255.0)) for x in colorsys.rgb_to_hsv(x/255.0, y/255.0, z/255.0)]
self.colorX.set(col[0])
self.colorY.set(col[1])
self.colorZ.set(col[2])
self.colorModeLocal = newMode
评论列表
文章目录