pymel.core.windows.uiTemplate

static windows.uiTemplate(name=None, force=False, exists=None)

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.

Flags:
Long name (short name) Argument Types Properties
defineTemplate (dt) unicode  
   
exists (ex) bool ../../../_images/create.gif
 

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 )

Previous topic

pymel.core.windows.treeView

Next topic

pymel.core.windows.valueControlGrp

Core

Core Modules

Other Modules

This Page