Tutorial by Examples

The Maya GUI toolkit creates a variety of UI elements in a simple, imperative form. There are basic commands to create and edit GUI widgets; the widgets are identified by a unique string name. All gui commands take the same basic form: you supply a command type and the string name of the object yo...
When you create a new widget with a UI command you can supply the name you'd like the new widget to get. However, its not guaranteed: Maya will give the button the name you asked for -- if you've given it a character it doesn't recognize or if there is already a widget with the same name you may get...
Many widgets include events which can fire callback functions when the user interacts with the widget. For example when a button is pressed, a checkbox checked, or a dropdown chosen you can fire a function. The exact flag which is associated with these event depends on the widget, but a typical cal...
# create a window with a button that closes the window when clicked window = cmds.window(title='example window') # create the window layout = cmds.columnLayout(adjustableColumn=True) # add a vertical layout def close_window(*_): cmds.deleteUI(window) # delet...
Lambdas are a useful shortcut for hooking up behaviors to GUI elements. b = cmds.button("make a cube", command = lambda _: cmds.polyCube()) However, due to the way Python captures variables inside of lambdas, you can get unexpected results if you bind commands using lambdas inside a lo...

Page 1 of 1