Go to: Synopsis. Return value. Flags. Python examples.
popupMenu(
string
, [allowOptionBoxes=boolean], [altModifier=boolean], [button=int], [ctrlModifier=boolean], [deleteAllItems=boolean], [itemArray=boolean], [markingMenu=boolean], [numberOfItems=boolean], [postMenuCommand=script], [postMenuCommandOnce=boolean], [shiftModifier=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
popupMenu is undoable, queryable, and editable.
This command creates a popup menu and attaches it to the current
control if no parent is specified. The popup menu is posted with the
right mouse button by default.
Popup menus can be added to any kind of control, however,
on some widgets, only the standard menu button (3rd mouse button)
can be used to trigger popup menus. This is to meet generally
accepted UI guidelines that assign the 3rd mouse button and only
this one to popup menus, and also to prevent unexpected behavior
of controls like text fields, that expect 1st and 2nd button to be
reserved for contextual operations like text or item selection...
string | Full path name to the menu. |
In query mode, return type is based on queried flag.
allowOptionBoxes, altModifier, button, ctrlModifier, deleteAllItems, itemArray, markingMenu, numberOfItems, postMenuCommand, postMenuCommandOnce, shiftModifier
Long name (short name) |
Argument types |
Properties |
|
allowOptionBoxes(aob)
|
boolean
|
|
|
Indicate whether the menu will be able to support option box
menu items. An error results if an option box item is added to a
menu that doesn't allow them. This flag may be queried and must be
specified when the popup menu is created. The default value is
false.
|
|
altModifier(alt)
|
boolean
|
|
|
Specify this flag if the Alt modifier must be pressed when
posting the popup menu.
|
|
button(b)
|
int
|
|
|
Indicate which button posts the popup menu. Valid values
range from 1 to 3 where 1 is the left most button on the mouse.
|
|
ctrlModifier(ctl)
|
boolean
|
|
|
Specify this flag if the Cntl modifier must be pressed when
posting the popup menu.
|
|
deleteAllItems(dai)
|
boolean
|
|
|
Delete all the items in this menu.
|
|
itemArray(ia)
|
boolean
|
|
|
Return string array of the menu item names.
|
|
markingMenu(mm)
|
boolean
|
|
|
Set the marking menu state of this popup menu.
|
|
numberOfItems(ni)
|
boolean
|
|
|
Return number of items in the menu.
|
|
postMenuCommand(pmc)
|
script
|
|
|
Specify a script to be executed when the popup menu is about
to be shown.
|
|
postMenuCommandOnce(pmo)
|
boolean
|
|
|
Indicate the -pmc/postMenuCommand should only be
invoked once. Default value is false, ie.
the -pmc/postMenuCommand is invoked every time the popup menu is
shown.
|
|
shiftModifier(sh)
|
boolean
|
|
|
Specify this flag if the Shift modifier must be pressed
when posting the popup menu.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
cmds.window()
cmds.columnLayout()
cmds.button()
cmds.popupMenu()
cmds.menuItem()
cmds.menuItem()
cmds.menuItem()
cmds.text()
cmds.popupMenu( button=1 )
cmds.menuItem()
cmds.menuItem()
cmds.menuItem()
cmds.checkBox( 'aCheckBox' )
cmds.popupMenu( parent='aCheckBox', alt=True, ctl=True )
cmds.menuItem()
cmds.menuItem()
cmds.menuItem()
cmds.showWindow()