10/10/22
The third session involved creating a window and adding buttons within it, also giving them a function. Starting with import maya.cmds, the next lines of code to make were:
window = cmds.window( title="Long Name", iconName='Short Name', widthHeight=(1000, 500) )
cmds.columnLayout( adjustableColumn=True )
cmds.button( label='Do Nothing' )
cmds.button( label='Close', command=('cmds.deleteUI(\"' + window + '\", window=True)') )
cmds.setParent( '..' )
cmds.showWindow( window )
Following this, when the script was run it brought up a window with 3 buttons. Each button was named "Do Nothing" and "Close" respectively. The first button had no function and the second closed down the window that was just opened, giving it a working function. I did try to add a third button named "Click" which would open another window from the one, however I wasn't able to.
Leave a comment
Log in with itch.io to leave a comment.