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

Class Menu

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

Menu Python Type, wrapping ObjC NSMenu.

Instance Methods
 
__init__(self, title='')
New Menu.
 
__len__(self)
 
append(self, *items)
Add one or more items or separators to this menu.
 
item(self, title, action=None, **kwds)
New menu item with action and optional shortcut key.
 
items(self, separators=False)
Yield each of the items in this menu (Item).
 
separator(self)
New menu separator.

Inherited from bases._Type2: __str__

Inherited from bases._Type0: __repr__, type2strepr

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

Properties

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='')
(Constructor)

 

New Menu.

Parameters:
  • title - The menu title (str).
Overrides: object.__init__

append(self, *items)

 

Add one or more items or separators to this menu.

Parameters:

item(self, title, action=None, **kwds)

 

New menu item with action and optional shortcut key.

Parameters:
  • title - Item title (str).
  • action - See Item.__init__.
  • kwds - See Item.__init__.
Returns:
New item (Item).

items(self, separators=False)

 

Yield each of the items in this menu (Item).

Parameters:
  • separators - Yield or skip Separator items (bool).

separator(self)

 

New menu separator.

Returns:
New item (Separator).