############################################################################# # gui.py by Andrew Osiow # Version 1.0 # Basic Python gui to simulate standard Maya Option Windows # # To Run: # Load this script into the script editor with a followed by a in the Python command line # # You can also import and execute the script without using the script editor # but you'll probably have type ############################################################################# import maya.cmds as cmds def gui(): guiWindow = cmds.window ( 'guiWindowObj', title="Gui Test", iconName='Gui', widthHeight=(20, 10), rtf=1 ) guiLayout = cmds.formLayout() guiIntField = cmds.intFieldGrp ( label="Cool Factor", extraLabel="watts", value1=10 ) guiFloatField = cmds.floatFieldGrp ( label="Coolness", extraLabel="juice", value1=9.9 ) guiTextField = cmds.textFieldGrp ( label="Place Some Text Here...", text='Editable' ) messageButton = cmds.button( label='Message!', width=150, height=26, align='center', command="cmds.confirmDialog( title='Test Dialog', message='Is Python Cool?', button=['Rocks','Whatever'] ), cmds.deleteUI('guiWindowObj', window=True)" ) applyButton = cmds.button( label='Apply', width=150, height=26, align='center', command="cmds.confirmDialog( title='Test Dialog', message='Is Python Cool?', button=['Rocks','Whatever'] )" ) closeButton = cmds.button( label='Close', width=150, height=26, align='center', command="cmds.deleteUI('guiWindowObj', window=True)" ) cmds.formLayout( guiLayout, edit=True, attachForm=[ (guiIntField, 'left', 12 ), (guiIntField, 'top', 12 ), (guiFloatField, 'left', 12 ), (guiTextField, 'left', 12 ), (messageButton, 'left', 4 ), (messageButton, 'bottom', 4 ), (applyButton, 'bottom', 4 ), (closeButton, 'bottom', 4 ), (closeButton, 'right', 4 )], attachControl=[ (guiFloatField, 'top', 12, guiIntField ), (guiTextField, 'top', 12, guiFloatField ), (messageButton, 'top', 12, guiTextField ), (applyButton, 'top', 12, guiTextField ), (closeButton, 'top', 12, guiTextField ), (applyButton, 'left', 4, messageButton ), (closeButton, 'left', 4, applyButton )]) cmds.showWindow (guiWindow)