当前位置: 首页>>代码示例>>Python>>正文


Python General.rgb_to_hex方法代码示例

本文整理汇总了Python中General.rgb_to_hex方法的典型用法代码示例。如果您正苦于以下问题:Python General.rgb_to_hex方法的具体用法?Python General.rgb_to_hex怎么用?Python General.rgb_to_hex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在General的用法示例。


在下文中一共展示了General.rgb_to_hex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Btn_CreatePartition

# 需要导入模块: import General [as 别名]
# 或者: from General import rgb_to_hex [as 别名]
    def Btn_CreatePartition(self):

        DestFile = ''
        Output = self.Step3Output.get()
        
        if General.validate_String(Output, '', False, False, True):
            self.DisplayMessage("  ERROR: Could not save the partition file because you entered an invalid name.", 2)
            return

        auto_zoom = cmd.get("auto_zoom")

        if Output != '':
            
            if not self.Vertex:
                self.top.DisplayMessage("  ERROR: Cannot save an empty cleft. Add spheres that include volume of the parent.", 1)
                return
            
            if General_cmd.object_Exists(Output):
                answer = tkMessageBox.askquestion("Question", 
                                                  message="An object with that name already exists. Would you like to overwrite it?",
                                                  icon='warning')
                if str(answer) == 'no':
                    return
                
            try:
                cmd.set("auto_zoom", 0)
                
                DestFile = os.path.join(self.top.GetCleftTempProject_Dir, Output + '.pdb')
                self.top.Manage.copy_TempPartition(self.TempPartition, DestFile)
                
                cmd.load(DestFile, Output, state=1)
                cmd.refresh()
                
                cmd.hide('everything', Output)
                cmd.refresh()

                cmd.show('surface', Output)
                cmd.refresh()
                
                partition_rgb = self.top.Default.SetPartitionColor(self.Cleft.CleftName)
                
                if len(partition_rgb):
                
                    cmd.color('partition', Output)
                    cmd.refresh()

                    cmd.delete(self.PartitionDisplay)
                    cmd.refresh()
                    
                    Cleft = CleftObj.CleftObj()
                    Cleft.CleftFile = DestFile
                    Cleft.CleftName = self.Step3Output.get()
                    Cleft.PartitionParent = self.Cleft
                    Cleft.Partition = True
                    Cleft.UTarget = self.Cleft.UTarget
                    Cleft.Set_CleftMD5()
                    Cleft.Color = General.rgb_to_hex(partition_rgb)
                    
                    self.top.Default.TempBindingSite.Add_Cleft(Cleft)
                    self.top.CopySession = False

                    # Put the partition cleft over its parent
                    General_cmd.Oscillate(self.Cleft.CleftName, 0.0)

                    self.Reset_Step1()
                    
                else:
                    self.top.DisplayMessage("  ERROR: Cleft '" + self.Cleft.CleftName + "' could not be found to set partition color", 1)

            except:
                self.top.DisplayMessage("  ERROR: Could not create partition object: File not found.", 1)
                
        else:
            self.top.DisplayMessage("  ERROR: Could not create partition object: Output is null.", 1)
            
        cmd.set("auto_zoom", auto_zoom)
开发者ID:NRGlab,项目名称:NRGsuite,代码行数:78,代码来源:CropCleft.py


注:本文中的General.rgb_to_hex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。