pymel.core.windows.setUITemplate

setUITemplate(*args, **kwargs)

This command sets the current(default) command template for the ELF commands. The special name NONE can be used to set no templates current. See uiTemplatecommand also.

Flags:

Long Name / Short Name Argument Types Properties
popTemplate / ppt bool ../../../_images/create.gif
  Pop the current template off of the stack and sets the next template on the stack to be current.
pushTemplate / pst bool ../../../_images/create.gif
  Push the current template onto a stack that can later be popped. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.setUITemplate

Example:

import pymel.core as pm

#    Create a new template.
#
if pm.uiTemplate( 'ExampleTemplate', exists=True ):
        pm.deleteUI( 'ExampleTemplate', uiTemplate=True )

pm.uiTemplate( 'ExampleTemplate' )
# Result: UITemplate(u'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 )
# Result: u'ExampleTemplate' #
pm.columnLayout( rowSpacing=5 )
# Result: ui.ColumnLayout('window1|columnLayout81') #

pm.frameLayout()
# Result: ui.FrameLayout('window1|columnLayout81|frameLayout24') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout81|frameLayout24|columnLayout82') #
pm.button( label='One' )
# Result: ui.Button('window1|columnLayout81|frameLayout24|columnLayout82|button90') #
pm.button( label='Two' )
# Result: ui.Button('window1|columnLayout81|frameLayout24|columnLayout82|button91') #
pm.button( label='Three' )
# Result: ui.Button('window1|columnLayout81|frameLayout24|columnLayout82|button92') #
pm.setParent( '..' )
# Result: u'window1|columnLayout81|frameLayout24' #
pm.setParent( '..' )
# Result: u'window1|columnLayout81' #

pm.frameLayout()
# Result: ui.FrameLayout('window1|columnLayout81|frameLayout25') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout81|frameLayout25|columnLayout83') #
pm.button( label='Red' )
# Result: ui.Button('window1|columnLayout81|frameLayout25|columnLayout83|button93') #
pm.button( label='Green' )
# Result: ui.Button('window1|columnLayout81|frameLayout25|columnLayout83|button94') #
pm.button( label='Blue' )
# Result: ui.Button('window1|columnLayout81|frameLayout25|columnLayout83|button95') #
pm.setParent( '..' )
# Result: u'window1|columnLayout81|frameLayout25' #
pm.setParent( '..' )
# Result: u'window1|columnLayout81' #

pm.setUITemplate( popTemplate=True )
# Result: u'NONE' #

pm.showWindow( window )