Go to: Synopsis. Notes. Return value. Python examples.

Synopsis

renameUI( string string )

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

renameUI is undoable, NOT queryable, and NOT editable.

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.

Notes

This command does not update other objects or commands that reference this object by name, so use this command at your own risk.

Return value

stringThe new name, or the old name if re-naming fails.

Python examples

import maya.cmds as cmds

#    Create a window with a single button.
#
window = cmds.window()
cmds.columnLayout()
cmds.button( 'exampleButton', label='Example' )
cmds.showWindow( window )

#    Edit the button label.
#
cmds.button( 'exampleButton', edit=True, label='New Label' )

#    Rename the button.
#
cmds.renameUI( 'exampleButton', 'newButton' )

#    Query the button label using the new object name.
#
cmds.button( 'newButton', query=True, label=True )