本文整理汇总了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)