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 “uiTemplate” command 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.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

pushTemplate (pst) bool ../../../_images/create.gif
 
Push the current template onto a stack that can later be popped.

Derived from mel command maya.cmds.setUITemplate

Example:

import pymel.core as pm

import maya.cmds as cmds

#    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|columnLayout80') #

pm.frameLayout()
# Result: ui.FrameLayout('window1|columnLayout80|frameLayout22') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout80|frameLayout22|columnLayout81') #
pm.button( label='One' )
# Result: ui.Button('window1|columnLayout80|frameLayout22|columnLayout81|button88') #
pm.button( label='Two' )
# Result: ui.Button('window1|columnLayout80|frameLayout22|columnLayout81|button89') #
pm.button( label='Three' )
# Result: ui.Button('window1|columnLayout80|frameLayout22|columnLayout81|button90') #
pm.setParent( '..' )
# Result: u'window1|columnLayout80|frameLayout22' #
pm.setParent( '..' )
# Result: u'window1|columnLayout80' #

pm.frameLayout()
# Result: ui.FrameLayout('window1|columnLayout80|frameLayout23') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout80|frameLayout23|columnLayout82') #
pm.button( label='Red' )
# Result: ui.Button('window1|columnLayout80|frameLayout23|columnLayout82|button91') #
pm.button( label='Green' )
# Result: ui.Button('window1|columnLayout80|frameLayout23|columnLayout82|button92') #
pm.button( label='Blue' )
# Result: ui.Button('window1|columnLayout80|frameLayout23|columnLayout82|button93') #
pm.setParent( '..' )
# Result: u'window1|columnLayout80|frameLayout23' #
pm.setParent( '..' )
# Result: u'window1|columnLayout80' #

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

pm.showWindow( window )

Previous topic

pymel.core.windows.setStartupMessage

Next topic

pymel.core.windows.shelfButton

Core

Core Modules

Other Modules

This Page