TkColorEdit.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Circadia 作者: hooyah 项目源码 文件源码
def setColor(self, r, g, b):
        """
        :param r: red, integer 0-255
        :param g: green, integer 0-255
        :param b: blue, integer 0-255
        :return: None
        """

        self.updateEnabled = False
        if self.colorModeLocal == 1: # hsv
            col = [ int(round(x*255)) for x in colorsys.rgb_to_hsv(float(r)/255,float(g)/255,float(b)/255)]
            self.colorX.set(col[0])
            self.colorY.set(col[1])
            self.colorZ.set(col[2])
            self.colorSwatch.itemconfig(self.crect, fill='#%02x%02x%02x'%(r, g, b))
        else: # RGB
            self.colorX.set(r)
            self.colorY.set(g)
            self.colorZ.set(b)
            self.colorSwatch.itemconfig(self.crect, fill='#%02x%02x%02x'%(r, g, b))
        self.updateEnabled = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号