Package pycocoa :: Module menus :: Class Item
[frames] | no frames]

Class Item

  object --+            
           |            
bases._Type0 --+        
               |        
    bases._Type1 --+    
                   |    
        bases._Type2 --+
                       |
                      Item

Python menu Item Type, wrapping ObjC NSMenuItem.

Instance Methods
 
__init__(self, title, action=None, key='', alt=False, cmd=True, ctrl=False, shift=False)
New menu Item.
 
__str__(self)
str(x)

Inherited from bases._Type0: __repr__, type2strepr

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables
  _SEL_ = <SEL_t(menuItemHandler:)>
Properties
  action
  alt
  cmd
  ctrl
  key
  shift

Inherited from bases._Type2: tag, title

Inherited from bases._Type1: NSdelegate, app

Inherited from bases._Type0: NS

Inherited from object: __class__

Method Details

__init__(self, title, action=None, key='', alt=False, cmd=True, ctrl=False, shift=False)
(Constructor)

 

New menu Item.

Parameters:
  • title - Item title (str).
  • action - Callback, the method to be called (str ending with ':' or _', SEL_t or None).
  • key - The shortcut key, if any (str).
  • alt - Hold option or alt with key (bool).
  • cmd - Hold command with key (bool).
  • cntl - Hold control with key (bool).
  • shift - Hold shift with {key} (bool).
Raises:
  • ValueError - Invalid title for None action.
Overrides: object.__init__

Note: A None action is set to the title, spaces and dots removed, etc., see function title2action.

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

Property Details

action

Get Method:
action(self)

alt

Get Method:
alt(self)

cmd

Get Method:
cmd(self)

ctrl

Get Method:
ctrl(self)

key

Get Method:
key(self)

shift

Get Method:
shift(self)