Your Ad Here

Go to: Synopsis. Return value. Python examples.

Synopsis

renameUI( <old name> <new name> )

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

renameUI is undoable, queryable, and editable.

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

NOTE: 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


The new name (string), 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 )

  

Return to Autodesk Index


Your Ad Here