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 appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
checkBox (cb) | bool | ||
|
|||
collection (cl) | unicode | ||
|
|||
command (c) | script | ||
|
|||
commandModifier (cmd) | bool | ||
|
|||
ctrlModifier (ctl) | bool | ||
|
|||
data (da) | int | ||
|
|||
defineTemplate (dt) | unicode | ||
divider (d) | bool | ||
|
|||
docTag (dtg) | unicode | ||
|
|
|||
dragMenuCommand (dmc) | script | ||
|
|||
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 | ||
optionBox (ob) | bool | ||
|
|||
optionBoxIcon (obi) | unicode | ||
The filename of an icon to be used instead of the usual option box icon. The icon is searched for in the folder specified by the XBMLANGPATH environment variable. The icon can be any size, but will be resized to the standard 16x16 pixels when drawn. |
|||
optionModifier (opt) | bool | ||
|
|||
parent (p) | unicode | ||
|
|||
postMenuCommand (pmc) | script | ||
|
|||
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”, “E” or “NE”. |
|||
radioButton (rb) | bool | ||
|
|||
shiftModifier (sh) | bool | ||
|
|||
sourceType (stp) | unicode | ||
Set the language type for a command script. Can only be used in conjunction with a command flag. Without this flag, commands are assumed to be the same language of the executing script. In query mode, will return the language of the specified command. Valid values are “mel” and “python”. |
|||
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
import maya.cmds as cmds
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.CommandMenuItem('window1|menu49|menuItem428') #
pm.menuItem( label='Blue' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem428|menuItem429') #
pm.menuItem( label='Green' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem428|menuItem430') #
pm.menuItem( label='Yellow' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem428|menuItem431') #
pm.setParent( '..', menu=True )
# Result: u'window1|menu49' #
pm.menuItem( divider=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem432') #
pm.radioMenuItemCollection()
# Result: ui.RadioMenuItemCollection('window1|menu49|radioMenuItemCollection7') #
pm.menuItem( label='Yes', radioButton=False )
# Result: ui.CommandMenuItem('window1|menu49|menuItem433') #
pm.menuItem( label='Maybe', radioButton=False )
# Result: ui.CommandMenuItem('window1|menu49|menuItem434') #
pm.menuItem( label='No', radioButton=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem435') #
pm.menuItem( divider=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem436') #
pm.menuItem( label='Top', checkBox=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem437') #
pm.menuItem( label='Middle', checkBox=False )
# Result: ui.CommandMenuItem('window1|menu49|menuItem438') #
pm.menuItem( label='Bottom', checkBox=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem439') #
pm.menuItem( divider=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem440') #
pm.menuItem( label='Option' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem441') #
pm.menuItem( optionBox=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem442') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout60') #
pm.button()
# Result: ui.Button('window1|columnLayout60|button52') #
pm.button()
# Result: ui.Button('window1|columnLayout60|button53') #
pm.button()
# Result: ui.Button('window1|columnLayout60|button54') #
pm.showWindow()
Enter search terms or a module, class or function name.