nuke.MenuItem

class nuke.MenuItem

Bases: object

Methods

action

Get the action associated with this menu item.

icon

Returns the name of the icon on this menu item as path of the icon.

invoke

Perform the action associated with this menu item.

name

Returns the name of the menu item.

script

Returns the script that gets executed for this menu item.

setEnabled

Enable or disable the item.

setIcon

Set the icon on this menu item.

setScript

Set the script to be executed for this menu item.

setShortcut

Set the keyboard shortcut on this menu item.

setVisible

Show or hide the item.

shortcut

Returns the keyboard shortcut on this menu item.

action() → None

Get the action associated with this menu item.

icon() → String

Returns the name of the icon on this menu item as path of the icon.

invoke() → None

Perform the action associated with this menu item.

name() → String

Returns the name of the menu item.

script() → String

Returns the script that gets executed for this menu item.

setEnabled(enabled, recursive) → None

Enable or disable the item. :param enabled: True to enable the object; False to disable it. :param recursive: True to also setEnabled on submenu actions.

setIcon(icon) → None

Set the icon on this menu item. :param icon: the new icon as a path

setScript(script) → None

Set the script to be executed for this menu item. Note: To call a python script file, you can use the execfile() function. i.e: menu.setScript(“execfile(‘script.py’)”)

setShortcut(keySequence) → None

Set the keyboard shortcut on this menu item. :param keySequence: the new shortcut in PortableText format, e.g. “Ctrl+Shift+P”

setVisible(visible) → None

Show or hide the item. :param visible: True to show the object; False to hide it.

shortcut() → String

Returns the keyboard shortcut on this menu item. The format of this is the PortableText format. It will return a string such as “Ctrl+Shift+P”. Note that on Mac OS X the Command key is equivalent to Ctrl.