pymel.core.windows.renameUI

renameUI(*args, **kwargs)

This command renames the UI object passed as first arument to the new name specified as second argument. If the new name is a duplicate, or not valid, then re-naming fails and the old name is returned.

Derived from mel command maya.cmds.renameUI

Example:

import pymel.core as pm

import maya.cmds as cmds

#    Create a window with a single button.
#
window = pm.window()
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout77') #
pm.button( 'exampleButton', label='Example' )
# Result: ui.Button('window1|columnLayout77|exampleButton') #
pm.showWindow( window )

#    Edit the button label.
#
pm.button( 'exampleButton', edit=True, label='New Label' )
# Result: ui.Button('window1|columnLayout77|exampleButton') #

#    Rename the button.
#
pm.renameUI( 'exampleButton', 'newButton' )
# Result: u'newButton' #

#    Query the button label using the new object name.
#
pm.button( 'newButton', query=True, label=True )
# Result: u'New Label' #

Previous topic

pymel.core.windows.refreshEditorTemplates

Next topic

pymel.core.windows.renderWindowEditor

Core

Core Modules

Other Modules

This Page