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 | ||
|
|||
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 | ||
|
|||
dragDoubleClickCommand (ddc) | script | ||
|
|||
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 | ||
version (ver) | unicode | ||
Specify the version that this menu item feature was introduced. The argument should be given as a string of the version number (e.g. “2013”, “2014”). Currently only accepts major version numbers (e.g. 2013.5 should be given as “2013”).Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
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.CommandMenuItem('window1|menu49|menuItem479') #
pm.menuItem( label='Blue' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem479|menuItem480') #
pm.menuItem( label='Green' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem479|menuItem481') #
pm.menuItem( label='Yellow' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem479|menuItem482') #
pm.setParent( '..', menu=True )
# Result: u'window1|menu49' #
pm.menuItem( divider=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem483') #
pm.radioMenuItemCollection()
# Result: ui.RadioMenuItemCollection('window1|menu49|radioMenuItemCollection7') #
pm.menuItem( label='Yes', radioButton=False )
# Result: ui.CommandMenuItem('window1|menu49|menuItem484') #
pm.menuItem( label='Maybe', radioButton=False )
# Result: ui.CommandMenuItem('window1|menu49|menuItem485') #
pm.menuItem( label='No', radioButton=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem486') #
pm.menuItem( divider=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem487') #
pm.menuItem( label='Top', checkBox=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem488') #
pm.menuItem( label='Middle', checkBox=False )
# Result: ui.CommandMenuItem('window1|menu49|menuItem489') #
pm.menuItem( label='Bottom', checkBox=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem490') #
pm.menuItem( divider=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem491') #
pm.menuItem( label='Option' )
# Result: ui.CommandMenuItem('window1|menu49|menuItem492') #
pm.menuItem( optionBox=True )
# Result: ui.CommandMenuItem('window1|menu49|menuItem493') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout61') #
pm.button()
# Result: ui.Button('window1|columnLayout61|button54') #
pm.button()
# Result: ui.Button('window1|columnLayout61|button55') #
pm.button()
# Result: ui.Button('window1|columnLayout61|button56') #
pm.showWindow()
Enter search terms or a module, class or function name.