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 # Create a window with a single button. # window = pm.window() pm.columnLayout() # Result: ui.ColumnLayout('window1|columnLayout78') # pm.button( 'exampleButton', label='Example' ) # Result: ui.Button('window1|columnLayout78|exampleButton') # pm.showWindow( window ) # Edit the button label. # pm.button( 'exampleButton', edit=True, label='New Label' ) # Result: ui.Button('window1|columnLayout78|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' #