This command creates/edits/queries menu items.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
allowOptionBoxes (aob) | bool | ||
Deprecated. All menus and menu items always allow option boxes. In the case of submenu items this flag specifies whether the submenu will be able to support option box menu items. Always returns true. |
|||
altModifier (alt) | bool | ||
|
|||
annotation (ann) | unicode | ||
|
|||
boldFont (bld) | bool | ||
Specify if text should be bold. Only supported in menus which use the marking menu implementation. Default is false for Windows, and true for all other platforms. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
checkBox (cb) | bool | ||
|
|||
collection (cl) | unicode | ||
|
|||
command (c) | callable | ||
|
|||
commandModifier (cmd) | bool | ||
|
|||
ctrlModifier (ctl) | bool | ||
|
|||
data (da) | int | ||
|
|||
defineTemplate (dt) | unicode | ||
divider (d) | bool | ||
|
|||
docTag (dtg) | unicode | ||
|
|||
dragDoubleClickCommand (ddc) | callable | ||
|
|||
dragMenuCommand (dmc) | callable | ||
|
|||
echoCommand (ec) | bool | ||
Specify whether the action attached with the c/commandflag should echo to the command output areas when invoked. This flag is false by default and must be specified with the c/commandflag. |
|||
enable (en) | bool | ||
|
|||
enableCommandRepeat (ecr) | bool | ||
This flag only affects menu items to which a command can be attached. Specify true and the command may be repeated by executing the command repeatLast. This flag is true by default for all items except for option box items. |
|||
exists (ex) | bool | ||
familyImage (fi) | unicode | ||
|
|||
image (i) | unicode | ||
The filename of the icon associated with the menu item. If the menu containing the menu item is being edited with a menuEditor widget, then the menuEditor will use this icon to represent the menu item. This icon will be displayed on the shelf when the menu item is placed there. |
|||
imageOverlayLabel (iol) | unicode | ||
Specify a short (5 character) text string to be overlayed on top of the icon associated with the menu item. This is primarily a mechanism for differentiating menu items that are using a Family icon due to the fact that an icon image had not been explicitly defined. The image overlay label will not be used if an icon image is defined for the menu item. |
|||
insertAfter (ia) | unicode | ||
Specify After which item the new one will be placed. If this flag is not specified, item is added at the end of the menu. Use the empty string to insert before the first item of the menu.WARNING: This flag is known to cause problems with tear off menus. It is recommended that you do not use it with menus that are tear off enabled. In other words, the parent menu should not have its to/tearOff flag set. |
|||
isCheckBox (icb) | bool | ||
|
|||
isOptionBox (iob) | bool | ||
|
|||
isRadioButton (irb) | bool | ||
|
|||
italicized (itl) | bool | ||
|
|||
keyEquivalent (ke) | unicode | ||
Specify the accelerator character. This character is combined with the modifier keys specified with the alt/altModifier, opt/optionModifier, ctl/ctlModifier, cmd/commandModifierand sh/shiftModifierto form the complete accelerator sequence that you can type to execute the menu item. Note that only regular menu items, radio menu items and check box menu items can have an accelerator. |
|||
label (l) | unicode | ||
|
|||
mnemonic (mn) | unicode | ||
Set the Alt key to activate that item. The character specified must match the case of its corresponding character in the menu item text, but selection from the keyboard is case insensitive. |
|||
optionBox (ob) | bool | ||
|
|||
optionModifier (opt) | bool | ||
|
|||
parent (p) | unicode | ||
|
|||
postMenuCommand (pmc) | callable | ||
|
|||
postMenuCommandOnce (pmo) | bool | ||
|
|||
radialPosition (rp) | unicode | ||
The radial position of the menu item if it is in a Marking Menu. Radial positions are given in the form of a cardinal direction, and may be N, NW, W, SW, S, SE, Eor NE. |
|||
radioButton (rb) | bool | ||
|
|||
shiftModifier (sh) | bool | ||
|
|||
subMenu (sm) | bool | ||
Indicates that the item will have a submenu. Subsequent menuItems will be added to the submenu until setParent -menuis called. Note that a submenu item creates a menu object and consequently the menucommand may be used on the submenu item. |
|||
tearOff (to) | bool | ||
|
|||
useTemplate (ut) | unicode | ||
Derived from mel command maya.cmds.menuItem
Example:
import pymel.core as pm
pm.window( menuBar=True, width=200 )
# Result: ui.Window('window1') #
pm.menu( label='Stuff' )
# Result: ui.Menu('window1|menu49') #
pm.menuItem( subMenu=True, label='Colors' )
# Result: ui.SubMenuItem('window1|menu49|menuItem563') #
pm.menuItem( label='Blue' )
# Result: ui.SubMenuItem('window1|menu49|menuItem563|menuItem564') #
pm.menuItem( label='Green' )
# Result: ui.SubMenuItem('window1|menu49|menuItem563|menuItem565') #
pm.menuItem( label='Yellow' )
# Result: ui.SubMenuItem('window1|menu49|menuItem563|menuItem566') #
pm.setParent( '..', menu=True )
# Result: u'window1|menu49' #
pm.menuItem( divider=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem567') #
pm.radioMenuItemCollection()
# Result: ui.RadioMenuItemCollection('window1|menu49|radioMenuItemCollection8') #
pm.menuItem( label='Yes', radioButton=False )
# Result: ui.SubMenuItem('window1|menu49|menuItem568') #
pm.menuItem( label='Maybe', radioButton=False )
# Result: ui.SubMenuItem('window1|menu49|menuItem569') #
pm.menuItem( label='No', radioButton=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem570') #
pm.menuItem( divider=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem571') #
pm.menuItem( label='Top', checkBox=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem572') #
pm.menuItem( label='Middle', checkBox=False )
# Result: ui.SubMenuItem('window1|menu49|menuItem573') #
pm.menuItem( label='Bottom', checkBox=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem574') #
pm.menuItem( divider=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem575') #
pm.menuItem( label='Option' )
# Result: ui.SubMenuItem('window1|menu49|menuItem576') #
pm.menuItem( optionBox=True )
# Result: ui.SubMenuItem('window1|menu49|menuItem577') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout61') #
pm.button()
# Result: ui.Button('window1|columnLayout61|button53') #
pm.button()
# Result: ui.Button('window1|columnLayout61|button54') #
pm.button()
# Result: ui.Button('window1|columnLayout61|button55') #
pm.showWindow()
Enter search terms or a module, class or function name.