Go to: Synopsis. Notes. Return value. Python examples.
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.string | The new name, or the old name if re-naming fails. |
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 )