maya Creating Maya UI Creating a window


Example

# 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)                          # deletes the window above

button = cmds.button(label= 'press to close", command = close_window)

# show the window
cmds.showWindow(window)