This command creates a new window but leaves it invisible. It is most efficient to add the window’s elements and then make it visible with the showWindow command. The window can have an optional menu bar. Also, the title bar and minimize/maximize buttons can be turned on or off. If the title bar is off, then you cannot have minimize or maximize buttons. Note: The window will require a control layout of some kind to arrange the controls (buttons, sliders, fields, etc.). Examples of control layouts are columnLayout, formLayout, rowLayout, etc. Note: This command will clear the uiTemplate stack. Templates for a window need to be set after the window cmd.
Flags:
Long Name / Short Name | Argument Types | Properties | |
---|---|---|---|
backgroundColor / bgc | float, float, float | ![]() ![]() |
|
|
|||
defineTemplate / dt | unicode | ![]() |
|
Puts a command in a mode where any other flags and args are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template. |
|||
docTag / dtg | unicode | ![]() ![]() ![]() |
|
|
|||
dockCorner / dc | unicode, unicode | ![]() |
|
Specifies which docking areas occupied the four different corners of the window. By default docking windows on the bottom or top will span the whole window. Use multiple instances of this flag to allow the left and right docking areas to occupy the corners. This method has two arguments: docking corner and docking area. Possible values for docking corner are topLeft, topRight, bottomLeft, and bottomRight. Possible values for docking area are left, right, top, and bottom. |
|||
dockStation / ds | bool | ![]() |
|
|
|||
dockingLayout / dl | unicode | ![]() ![]() ![]() |
|
When queried this flag will return a string holding the docking layout information. This string can be set when creating or editing a docking station to restore the previous docking layout. This string is a hexadecimal representation of a binary string and is not meant to be humanly readable, but can be saved and loaded using the optionVar command to restore layouts across sessions of Maya. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
exists / ex | bool | ![]() |
|
|
|||
frontWindow / fw | bool | ![]() |
|
Return the name of the front window. Note: you must supply the name of any window (the window does not need to exist). Returns unknownif the front window cannot be determined. |
|||
height / h | int | ![]() ![]() ![]() |
|
|
|||
iconName / iconName | unicode | ![]() ![]() ![]() |
|
|
|||
iconify / i | bool | ![]() ![]() ![]() |
|
|
|||
interactivePlacement / ip | bool | ![]() |
|
|
|||
leftEdge / le | int | ![]() ![]() ![]() |
|
|
|||
mainMenuBar / mm | bool | ||
mainWindow / mw | bool | ![]() ![]() ![]() |
|
|
|||
maximizeButton / mxb | bool | ![]() ![]() ![]() |
|
|
|||
menuArray / ma | bool | ![]() |
|
|
|||
menuBar / mb | bool | ![]() ![]() |
|
|
|||
menuBarVisible / mbv | bool | ![]() ![]() ![]() |
|
|
|||
menuIndex / mi | unicode, int | ![]() |
|
|
|||
minimizeButton / mnb | bool | ![]() ![]() ![]() |
|
|
|||
minimizeCommand / mnc | script | ![]() ![]() |
|
|
|||
nestedDockingEnabled / nde | bool | ![]() |
|
|
|||
numberOfMenus / nm | bool | ![]() |
|
|
|||
parent / p | unicode | ![]() |
|
Specifies a parent window or layout which the created window is always on top of. Note: If the parent is a window the created window is not modal, so events are still propagated to the parent window. |
|||
resizeToFitChildren / rtf | bool | ![]() ![]() ![]() |
|
|
|||
restoreCommand / rc | script | ![]() ![]() |
|
|
|||
retain / ret | bool | ![]() |
|
|
|||
sizeable / s | bool | ![]() ![]() ![]() |
|
|
|||
title / t | unicode | ![]() ![]() ![]() |
|
|
|||
titleBar / tb | bool | ![]() ![]() ![]() |
|
|
|||
titleBarMenu / tbm | bool | ![]() ![]() ![]() |
|
|
|||
toolbox / tlb | bool | ![]() ![]() ![]() |
|
|
|||
topEdge / te | int | ![]() ![]() ![]() |
|
|
|||
topLeftCorner / tlc | int, int | ![]() ![]() ![]() |
|
|
|||
useTemplate / ut | unicode | ![]() |
|
|
|||
visible / vis | bool | ![]() ![]() ![]() |
|
|
|||
width / w | int | ![]() ![]() ![]() |
|
|
|||
widthHeight / wh | int, int | ![]() ![]() ![]() |
|
|
Derived from mel command maya.cmds.window
Example:
import pymel.core as pm
# Make a new window
#
window = pm.window( title="Long Name", iconName='Short Name', widthHeight=(200, 55) )
pm.columnLayout( adjustableColumn=True )
# Result: ui.ColumnLayout('window1|columnLayout98') #
pm.button( label='Do Nothing' )
# Result: ui.Button('window1|columnLayout98|button111') #
pm.button( label='Close', command=('pm.deleteUI(\"' + window + '\", window=True)') )
# Result: ui.Button('window1|columnLayout98|button112') #
pm.setParent( '..' )
# Result: u'' #
pm.showWindow( window )
# Resize the main window
#
# This is a workaround to get MEL global variable value in Python
gMainWindow = maya.mel.eval('$tmpVar=$gMainWindow')
pm.window( gMainWindow, edit=True, widthHeight=(900, 777) )
# Result: ui.Window('MayaWindow') #