convert_color_code.py 文件源码

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

项目:surume 作者: tm8r 项目源码 文件源码
def _convert(self, *args):
        u"""?????????"""
        code = cmds.textFieldButtonGrp(self.color_code_field, q=True, tx=True)
        if len(code) == 7 and code.startswith("#"):
            code = code[1:]
        if len(code) != 6:
            return
        try:
            int(code, 16)
        except ValueError, e:
            print(e)
            return
        decimal_point = cmds.intFieldGrp(self.decimal_point_field, q=True, v1=True)
        r = round(int(code[0:2], 16) / 255, decimal_point)
        g = round(int(code[2:4], 16) / 255, decimal_point)
        b = round(int(code[4:6], 16) / 255, decimal_point)
        bgc = self._COLOR_FORMAT.format(str(r), str(g), str(b))
        cmds.textFieldGrp(self.result_field, e=True, tx=bgc)
        cmds.text(self.color_preview, e=True, bgc=[r, g, b])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号