本文整理汇总了Python中pymel.core.button函数的典型用法代码示例。如果您正苦于以下问题:Python button函数的具体用法?Python button怎么用?Python button使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了button函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gui
def gui():
'''
creates the gui for the tool
'''
win = 'uvtools'
if(pm.window(win, ex = True)):
pm.deleteUI(win)
if(pm.windowPref(win, ex = True)):
pm.windowPref(win, remove = True)
global scroll_list, dyn_uis
myWin = pm.window(win, title='Anim UV Tool' , sizeable = True, mnb = True, width = 500, height = 400, backgroundColor= [.68,.68,.68])
pm.scrollLayout(width= 500)
pm.button(label= 'Creates Nodes', command= create_nodes, width= 500)
row_layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= [[1, 150], [2, 10], [3, 340]])
pm.columnLayout(adjustableColumn= False, width=150)
scroll_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(create_ui))
pm.button(label= 'List Nodes', command= list_nodes, width= 148)
pm.setParent(row_layout)
pm.text(label= '')
dyn_uis = pm.columnLayout(adjustableColumn= False, width= 340)
# listing the nodes at start up
list_nodes()
myWin.show()
示例2: __init__
def __init__(self, questions_file):
self.file = open(questions_file, 'r')
self.questions = self.file.readlines()
self.file.close()
self.main_layout = pm.columnLayout()
self.name_field = pm.textFieldGrp(label= 'Quiz Name')
self.layout = pm.rowColumnLayout(numberOfColumns= 2,
columnWidth= ([1, 75], [2, 475]))
pm.columnLayout()
pm.text(label= 'Questions')
self.question_scroll_list = pm.textScrollList(width= 60, height= 400,
selectCommand= pm.Callback(self.read_questions),
allowMultiSelection= True)
pm.setParent(self.layout)
pm.columnLayout()
pm.text(label= 'Questions Info')
self.question_scroll_field = pm.scrollField(wordWrap= True,
height= 400, width= 475)
pm.setParent(self.main_layout)
pm.button(label= 'Create Quiz', command= pm.Callback(self.create_quiz),
width= 550, height= 50)
self.list_questions()
示例3: rh_dynamicJoint
def rh_dynamicJoint():
#Create a variable for the window name
winName = 'DynamicJoint'
winTitle = 'rh_DynamicJoint_prototype_v0.23'
#Delete the window if it exists
if pm.window(winName, exists = True):
pm.deleteUI(winName, window = True)
#Build the main window
pm.window(winName, title = winTitle, sizeable = True)
#name field
pm.textFieldGrp('NameTFG',label = 'Set up name:', text = 'Ribbon45hp', ed = True)
pm.columnLayout(adjustableColumn = True)
#side
pm.radioButtonGrp('ColSel',nrb = 3,label = 'Side:',la3 = ['l','m','r'],sl = 1)
pm.columnLayout(adjustableColumn = True)
#axis
pm.radioButtonGrp('AxisSel',nrb = 3,label = 'Axis:',la3 = ['x','y','z'],sl = 1)
pm.columnLayout(adjustableColumn = True)
#ccSize
pm.floatSliderGrp('Cc_Size',label = 'Control Size:',f = True,min = 1,max = 10,fmn = 1,fmx = 100,v = 1)
pm.columnLayout(adjustableColumn = True)
#joint number
pm.intSliderGrp('Joint_Num',label = 'Number Of Joints:',f = True,min = 4,max = 49,fmn = 1,fmx = 100,v = 4)
pm.columnLayout(adjustableColumn = True)
#inbound
pm.button(label = 'Ready For Tasking', command = 'inbound()')
pm.columnLayout(adjustableColumn = True)
#bringTheRain
pm.button(label = 'Target Acquire', command = 'bringTheRain()')
pm.columnLayout(adjustableColumn = True)
#Show the window
pm.showWindow(winName)
pm.window(winName, edit = True, width = 378, height = 210)
示例4: __init__
def __init__(self, node):
self.node = node # the polymove UV node
self.layout = pm.frameLayout(label= '%s' % (self.node), width= 340,
collapsable= True)
pm.button(label= 'Delete UI', command= pm.Callback(self.delete_ui))
示例5: __init__
def __init__(self, debug=0):
title="TransferBlendShapes"
if(pm.windowPref(title, q=True, ex=True)):
pm.windowPref(title, remove=True)
if(pm.window(title, q=True, ex=True)):
pm.deleteUI(title)
self.win = pm.window(title, title="Transfer BlendShapes Tool")
self.rowColumnLayoutA = pm.rowColumnLayout()
self.intro = pm.text( label='complete the following steps in order' )
self.frameLayoutA = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 1 Load Target Mesh', borderStyle='in' )
self.columnlayoutA = pm.columnLayout()
self.frameLayoutB = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 2 Import Mask', borderStyle='in' )
self.columnlayoutA = pm.columnLayout()
self.frameLayoutC = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 3 Manipulate Match Mesh', borderStyle='in' )
self.columnlayoutB = pm.columnLayout()
self.frameLayoutD = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 4 Transfer Blends', borderStyle='in' )
self.columnlayoutC = pm.columnLayout()
#self.dockControl = pm.dockControl(label=title, area='right', content=title, allowedArea=['right', 'left'], sizeable=True)
# fameA content
self.names = {'Target':None}
# Generating x number of fields based on dictionary keys of self.names
for name in self.names:
self.names[name] = pm.textFieldButtonGrp(cw = ((1, 76), (2, 176)), parent=self.frameLayoutA,
label = name,
placeholderText = 'Enter Name Here or >>>> ',
buttonLabel = 'load selected', tcc= self.prepTargetMeshOn,
buttonCommand = pm.Callback(self.nameField_load, name))
self.btn_prepTgt = pm.button(parent=self.frameLayoutA, enable=False, w=40, h=20, label="Prep Target", command=self.prepTargetMesh)
self.fA_fillText = pm.text(parent=self.frameLayoutA, label=' ' )
# fameB content
self.importText = pm.text(parent=self.frameLayoutB, label='Import the desired facial mask' )
self.manipulateText = pm.text(parent=self.frameLayoutB, label='Use the avalable controls to manipulate the mask' )
self.fitText = pm.text(parent=self.frameLayoutB, label='Roughly fit the mask to the target mesh' )
self.btn_trueHuman = pm.button(parent=self.frameLayoutB, enable=True, w=40, h=20, label="Human Anatomy", command=self.humanAnatomyImport)
self.btn_trueMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Anatomy", command=self.muzzleAnatomyImport)
self.btn_toonHuman = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Human Toon", command=self.humanToonImport)
self.btn_toonMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Toon", command=self.muzzleToonImport)
self.fB_fillText = pm.text(parent=self.frameLayoutB, label=' ' )
# fameC content
self.matchMeshText = pm.text(parent=self.frameLayoutC, label='activate match mesh and refine your geometry to better match the target' )
self.btn_trueHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="Activate Match Mesh", command=self.matchMesh)
self.btn_templateHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="template Target Mesh", command=self.tempTgt)
self.btn_referenceHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="reference Target Mesh", command=self.refTgt)
self.sldr_smooth = pm.intSliderGrp(parent=self.frameLayoutC, field=True, label='Match Mesh Divisions', minValue=-0, maxValue=4, fieldMinValue=-0, fieldMaxValue=4, value=0, cc=self.div_Slider_change)
self.fC_fillText = pm.text(parent=self.frameLayoutC, label=' ' )
# fameD content
self.btn_go = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="Transfer Shapes", command=self.execute)
self.btn_no = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="NO DONT DO IT!", command=self.close)
self.fE_fillText = pm.text(parent=self.frameLayoutD, label=' ' )
self.win.show()
if debug:
test = ['mask_blendPipe_GEO', 'mask_hiRes_GEO']
for name, test_val in zip(self.names, test):
self.names[name].setText(test_val)
示例6: uiContents
def uiContents():
with pm.frameLayout(l='Color', cll=True, mw=3, mh=3 ):
with pm.columnLayout(adj=True):
with pm.rowLayout(nc=2):
pm.text(label='Set Override Color : ', align='right', w=130)
with pm.rowColumnLayout( nc=10 ):
wh=18
for i in range(0,32):
rgb = (0,0,0)
if i == 0:
rgb = (0.5,0.5,0.5)
anno = 'Reset'
pm.symbolButton( i=iconPath+'ui_colorNone.png', annotation=anno, w=wh, h=wh, c=pm.Callback( setColor.setColor, color=i ) )
else:
rgb = pm.colorIndex( i, q=True )
anno = '- index : %d\n- RGB : %03.3f %03.3f %03.3f\n- name : %s'%(i, rgb[0], rgb[1], rgb[2], setColor.color_intToStr(i) )
pm.canvas(
rgbValue = rgb,
annotation = anno,
w=wh, h=wh,
pressCommand = pm.Callback( setColor.setColor, color=i )
) #partial( self.setColor, i, True , self._toShape)) #partial( self.setColor, i, False, False))
pm.separator(h=8,style='in')
with pm.rowLayout( nc=10 ):
pm.text(label='Set Wire Frame Color : ', align='right', w=130)
pm.button(label='Object Color Palette', c=pm.Callback( pm.mel.objectColorPalette ), w=180 )
# ======================================
# Buttons
# ======================================
示例7: __init__
def __init__(self):
respresets = [4096, 2048, 1024, 512, 256, 128, 64, 32]
with pm.frameLayout(l='Options', cll=True, cl=False, bs='out'):
with pm.columnLayout():
pm.text('Map Size:')
pm.separator(st='in', width=160, height=8)
with pm.rowColumnLayout(nc=3, cw=[20, 60]):
pm.text(l='Width:')
self.width = pm.intField(v=1024, width=42)
with pm.optionMenu():
for i in respresets:
pm.menuItem(l=i)
pm.text(l='Height:')
self.height = pm.intField(v=1024, width=42)
with pm.optionMenu():
for i in respresets:
pm.menuItem(l=i)
pm.button(l='Get Map Size')
pm.separator(st='in', width=160, height=8)
with pm.columnLayout():
self.compSpace = pm.checkBox(l='Retain Component Spaceing',
cc=lambda *args: pm.texMoveContext('texMoveContext', e=True,
scr=self.compSpace.getValue()),
v=pm.texMoveContext('texMoveContext', q=True, scr=True))
self.pixelUnits = pm.checkBox(l='Transform In Pixels')
示例8: GUI
def GUI(self):
# Create GUI with window and 3 buttons
self._win = pmc.window(self.WINDOW_NAME, title = self.WINDOW_TITLE)
pmc.columnLayout(adjustableColumn = True)
pmc.button(label = "Stretch It!", c = pmc.Callback(self._callbackBind))
pmc.button(label = "Cancel", c = pmc.Callback(pmc.deleteUI, self._win))
self._win.show()
示例9: __init__
def __init__(self, template):
self.template = template
self.win = "arnold_filter_list_win"
if pm.window(self.win, exists=True):
pm.deleteUI(self.win)
pm.window(self.win, title="Add Light Filter",
sizeable=False,
resizeToFitChildren=True)
#pm.windowPref(removeAll=True)
pm.columnLayout(adjustableColumn=True,
columnOffset=("both", 10),
#columnAttach=('both',1),
rowSpacing=10)
self.scrollList = pm.textScrollList('alf_filter_list', nr=4, ams=False)
pm.textScrollList(self.scrollList,
e=True,
doubleClickCommand=Callback(self.addFilterAndHide))
for label, nodeType in self.filters():
pm.textScrollList(self.scrollList, edit=True, append=label)
pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center"))
pm.button(width=100, label="Add", command=Callback(self.addFilterAndHide))
pm.button(width=100, label="Cancel", command=Callback(pm.deleteUI, self.win, window=True))
pm.setParent('..')
pm.setParent('..')
pm.showWindow(self.win)
示例10: UI_controlModuleSelected
def UI_controlModuleSelected(self, *args):
moduleNameInfo = pm.textScrollList(self.UIElements["controlModule_textScrollList"], query = True, selectItem = True)
if len(moduleNameInfo) == 0:
pm.text(self.UIElements["nameText"], edit = True, label = 'No Animation Modules to Install')
pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = '')
pm.button(self.UIElements["installButton"], edit = True, enable = False)
return
else:
moduleName = moduleNameInfo[0]
mod = None
for controlModule in self.controlModuleCompatability:
if controlModule[1] == moduleName:
mod = controlModule[0]
if mod != None:
moduleTitle = mod.TITLE
moduleDescription = mod.DESCRIPTION
pm.text(self.UIElements["nameText"], edit = True, label = moduleTitle)
pm.scrollField(self.UIElements["descriptionScrollField"], edit = True, text = moduleDescription)
pm.button(self.UIElements["installButton"], edit = True, enable = True, command = partial(self.InstallModule, mod, moduleName))
示例11: GUI
def GUI(self):
self._win = pmc.window(self.WINDOW_NAME, title=self.WINDOW_TITLE)
pmc.columnLayout(adjustableColumn=True)
self._slider = pmc.intSliderGrp(label='Segments', field=True, min=2, max=100, value=2)
pmc.button(label='Okay', c=pmc.Callback(self._callback))
pmc.button(label='Cancel', c=pmc.Callback(pmc.deleteUI, self._win))
self._win.show()
示例12: _buildupWindow
def _buildupWindow(self):
if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()):
_pmCore.deleteUI(self._window, window=True)
self._window = _pmCore.window(title=self._winTitle)
_pmCore.columnLayout(adjustableColumn=True)
_pmCore.scrollLayout(width=300, height=250, childResizable=True)
_pmCore.gridLayout(numberOfColumns=2, cellHeight = self._iconSize, cellWidth=self._iconSize)
for versionNum in _Database.getVersionList(self._fileID):
versionInfo = _Database.getVersionInfo(self._fileID, versionNum)
print versionInfo
thumbnailPath = versionInfo[3]
if not _os.path.exists(versionInfo[3]):
thumbnailPath = "cube.png"
button = _pmCore.iconTextButton(self._versionBtnName(versionNum), style='iconAndTextVertical', image1=thumbnailPath,
label=self._versionBtnName(versionNum), command=_pmCore.Callback(self._versionSelected, versionNum))
self._uiWidget[self._versionBtnName(versionNum)] = button
_pmCore.setParent('..')
_pmCore.setParent('..')
_pmCore.separator(style='none', height=10)
_pmCore.text(label="Comments: ", align='left')
self._uiWidget['commentLayout'] = _pmCore.scrollLayout(width=300, height=120, childResizable=True)
_pmCore.setParent('..')
_pmCore.separator(style='none', height=10)
self._uiWidget['comment'] = _pmCore.scrollField(width=300, height=80)
_pmCore.button(label='Add Comment', command=_pmCore.Callback(self._commentAdded))
示例13: ui_reload_tools
def ui_reload_tools(self, *uiargs, **kwargs):
'''
Source toolbox base path for tools scripts/folders
'''
if self.verbose: print '\t...Reloading tools'
# TO-DO:
# Add additional registration for tools which
# will provide more information to the UI.
# - Help Info (button)
# - Neat name for button
# : This will likely require a secondary
# utility script to perform file parsing
# possibly using the ast module for literal_eval
# or using a JSON/XML format.
# - Folder support
## SIMPLE VERSION ##
# As the simple version, only take script files at face value and execute.
# Check paths
if self.ui_path.getText():
source_path = self.ui_path.getText()
else:
source_path = self.ui_path.getPlaceholderText()
source_path = os.path.normpath(source_path)
if not os.path.exists(source_path):
pm.warning('The toolbox path you are trying to source does not exist.')
return
# Add to sys.path
if source_path not in sys.path:
if self.verbose: print 'Adding source path to the sys.path...'
sys.path.append(source_path)
if self.verbose: print 'Sourcing from: ', source_path
# Find contents of folder and identify scripts.
tool_dir = os.walk(source_path)
tool_file_list = [x for x in tool_dir.next()[2] if not '__init__' in x]
if self.verbose: print 'tool_file_list: ', tool_file_list
if not tool_file_list:
pm.warning('Could not find any valid tool files to add.')
return
# Kill old toolbox lists (archives)
if self.toolbox_archive:
pm.deleteUI(self.toolbox_archive)
# Add UI elements which represent the files on disk.
pm.setParent(self.ui_toolbox_layout)
with pm.scrollLayout() as self.toolbox_archive:
for tool in tool_file_list:
exec_path = os.path.join(source_path, tool)
if self.verbose: print exec_path
pm.button( label= tool.partition('.')[0],
command= pm.Callback(execfile, exec_path) )
示例14: __init__
def __init__(self):
'''
# class to sort and give info on shaders
'''
self.layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth=([1, 150],
[2, 150], [3, 250]))
pm.columnLayout()
pm.text(label= 'Shaders')
self.shader_list = pm.textScrollList(width= 150, height= 200,
selectCommand= pm.Callback(self.update_connections_list))
pm.button(label= 'Refresh', width= 150,
command= pm.Callback(self.update_shader_list))
pm.setParent(self.layout)
pm.columnLayout()
pm.text(label='Connections')
self.connections_list = pm.textScrollList(width= 150, height= 200,
selectCommand= pm.Callback(self.write_info))
self.check_box = pm.checkBox(label= 'Select Node')
pm.setParent(self.layout)
pm.columnLayout()
pm.text(label='Node Info')
self.info_field = pm.scrollField(wordWrap= True, width= 250, height= 200)
self.attr_check_box = pm.checkBox(label= 'Show All')
self.update_shader_list()
示例15: createUI
def createUI( SWindowTitle, pApplyCallback ):
windowID = 'vcgnWindowID'
# If Window is Already Open, Delete it and Open a New One
if pm.window( windowID, exists=True ):
pm.deleteUI( windowID )
# Init Window
pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
pm.text( label='Min Value:' )
# Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Minimum Value, It Can't Go below 0.0 or above 1.0" )
pm.separator( h=10, style='none' )
pm.text( label='Max Value:' )
# Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Maximum Value, It Can't Go below 0.0 or above 1.0" )
pm.separator( h=10, style='none' )
# Formatting
pm.separator( h=10, style='none' )
pm.separator( h=10, style='none' )
pm.separator( h=10, style='none' )
pm.text( label='Noise Type:' )
# Noise Options - Enabled in 2.0
NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=True, annotation="Select Alternate Distributions and Generation Functions Here" )
pm.menuItem( label='Simple', parent='NoiseFunctions', annotation="A Simple Psuedo Random Noise Function that generates Random Values Between Min and Max" )
pm.menuItem( label='Perlin', parent='NoiseFunctions', annotation="Try Moving the Object Around for More Variety with Perlin Noise" )
pm.menuItem( label='3D Weighted', parent='NoiseFunctions', annotation="This Function Uses a Mixed Up Vertex List Randomly Adjust the Appearance of a Psuedo Random Number Generation" )
pm.menuItem( label='Triangular', parent='NoiseFunctions', annotation="This Function Uses a Psuedo Random Number Generator with a Triangular Distribution" )
pm.menuItem( label='Gamma', parent='NoiseFunctions', annotation="This Function Uses the Gamma Distribution, Does Not Work Well with Low Min Values, Suggestion Minimum 0.1" )
pm.separator( h=10, style='none' )
# Formatting
pm.separator( h=10, style='none' )
pm.separator( h=10, style='none' )
pm.separator( h=10, style='none' )
# Buttons
pm.separator( h=10, style='none' )
pm.button( label='Apply', command=functools.partial(pApplyCallback,
NoiseOption,
MaxValueField,
MinValueField) )
def cancelCallback( *Args ):
if pm.window( windowID, exists=True ):
pm.deleteUI( windowID )
pm.button( label='Cancel', command=cancelCallback )
pm.showWindow()