Go to: Synopsis. Return value. Flags. Python examples.
menu(
[string]
, [allowOptionBoxes=boolean], [defineTemplate=string], [deleteAllItems=boolean], [docTag=string], [enable=boolean], [exists=boolean], [familyImage=string], [helpMenu=boolean], [itemArray=boolean], [label=string], [mnemonic=string], [numberOfItems=boolean], [parent=string], [postMenuCommand=script], [postMenuCommandOnce=boolean], [scrollable=boolean], [tearOff=boolean], [useTemplate=string], [version=string], [visible=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
menu is undoable, queryable, and editable.
This command creates a new menu and adds it to the default window's
menubar if no parent is specified. The menu can be enabled/disabled.
Note that this command may also be used on menu objects created using
the command menuItem -sm/subMenu true.
string | Full path name to the menu. |
In query mode, return type is based on queried flag.
allowOptionBoxes, defineTemplate, deleteAllItems, docTag, enable, exists, familyImage, helpMenu, itemArray, label, mnemonic, numberOfItems, parent, postMenuCommand, postMenuCommandOnce, scrollable, tearOff, useTemplate, version, visible
Long name (short name) |
Argument types |
Properties |
|
allowOptionBoxes(aob)
|
boolean
|
|
|
Deprecated. All menus now always allow option boxes.
Indicate whether the menu will be able to support option box
menu items.
|
|
defineTemplate(dt)
|
string
|
|
|
Puts the command in a mode where any other flags and arguments 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.
|
|
deleteAllItems(dai)
|
boolean
|
|
|
Delete all the items in this menu.
|
|
docTag(dtg)
|
string
|
|
|
Attaches a tag to the menu.
|
|
enable(en)
|
boolean
|
|
|
Enables/disables the menu.
|
|
exists(ex)
|
boolean
|
|
|
Returns whether the
specified object exists or not. Other flags are ignored.
|
|
familyImage(fi)
|
string
|
|
|
The filename of the icon associated with the menu. This
icon will be used if a menu item does not have an icon image
defined.
|
|
helpMenu(hm)
|
boolean
|
|
|
Indicates that this menu is the help menu and will be the
right most menu in the menu bar. On Unix systems the help menu
is also right justified in the menu bar.
|
|
itemArray(ia)
|
boolean
|
|
|
Return string array of the menu item names.
|
|
label(l)
|
string
|
|
|
The text that is displayed for the menu. If no label is
supplied then the menuName will be used.
|
|
mnemonic(mn)
|
string
|
|
|
Set the Alt key to post that menu. The character
specified must match the case of its corresponding character in
the menu item text, but selection from the keyboard is case
insensitive.
|
|
numberOfItems(ni)
|
boolean
|
|
|
Return number of items in the menu.
|
|
parent(p)
|
string
|
|
|
Specify the window that the menu will appear in.
|
|
postMenuCommand(pmc)
|
script
|
|
|
Specify a script to be executed when the 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 menu is
shown.
|
|
scrollable(srb)
|
boolean
|
|
|
Make the popup menus support scrolling. Default value is false.
|
|
tearOff(to)
|
boolean
|
|
|
Makes the menu tear-off-able.
|
|
useTemplate(ut)
|
string
|
|
|
Forces the command to use a command template other than
the current one.
|
|
version(ver)
|
string
|
|
|
Specify the version that this menu feature was introduced.
The argument should be given as a string of the version number
(e.g. "2014", "2015"). Currently only accepts major version
numbers (e.g. 2014.5 should be given as "2014").
|
|
visible(vis)
|
boolean
|
|
|
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( menuBar=True, width=200 )
cmds.menu( label='File', tearOff=True )
cmds.menuItem( label='New' )
cmds.menuItem( label='Open' )
cmds.menuItem( label='Save' )
cmds.menuItem( divider=True )
cmds.menuItem( label='Quit' )
cmds.menu( label='Help', helpMenu=True )
cmds.menuItem( 'Application..."', label='"About' )
cmds.columnLayout()
cmds.button()
cmds.button()
cmds.button()
cmds.showWindow()