This command creates a new command template object. Template objects can hold default flag arguments for multiple UI commands. The command arguments are specified with the individual commands using the -defineTemplate flag and the desired flags and arguments. See also setUITemplate.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
defineTemplate (dt) | unicode | ||
exists (ex) | bool | ||
Returns true|false depending upon whether the specified uiTemplate exists. Other flags are ignored. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
useTemplate (ut) | unicode | ||
Derived from mel command maya.cmds.uiTemplate
Example:
import pymel.core as pm
# Create a new template.
#
if pm.uiTemplate( 'ExampleTemplate', exists=True ):
pm.deleteUI( 'ExampleTemplate', uiTemplate=True )
pm.uiTemplate( 'ExampleTemplate' )
pm.button( defineTemplate='ExampleTemplate', width=100, height=40, align='left' )
pm.frameLayout( defineTemplate='ExampleTemplate', borderVisible=True, labelVisible=False )
# Create a window and apply the template.
#
window = pm.window()
pm.setUITemplate( 'ExampleTemplate', pushTemplate=True )
pm.columnLayout( rowSpacing=5 )
pm.frameLayout()
pm.columnLayout()
pm.button( label='One' )
pm.button( label='Two' )
pm.button( label='Three' )
pm.setParent( '..' )
pm.setParent( '..' )
pm.frameLayout()
pm.columnLayout()
pm.button( label='Red' )
pm.button( label='Green' )
pm.button( label='Blue' )
pm.setParent( '..' )
pm.setParent( '..' )
pm.setUITemplate( popTemplate=True )
pm.showWindow( window )