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

Class MenuBar

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

Python MenuBar Type, wrapping ObjC NSMenu.

Instance Methods
 
__init__(self, app=None)
New MenuBar.
 
__len__(self)
Return the number of menus in this menu bar (int).
 
append(self, *menus)
Add one or more sub-menus to this menu bar.
 
__getitem__(self, index)
Yield one or several menus by index, by slice or by title.
 
main(self, app=None)
Make this menu bar the app's main menu.
 
menu(self, title='', dflt=None)
Find a menu by title.
 
menus(self)
Yield the menus of this menu bar.

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
  height
Get this menu bar's height (float).

Inherited from bases._Type2: tag, title

Inherited from bases._Type1: NSdelegate, app

Inherited from bases._Type0: NS, NSDelegate

Inherited from object: __class__

Method Details

__init__(self, app=None)
(Constructor)

 

New MenuBar.

Parameters:
  • app - The application (App or None).
Raises:
  • TypeError - If app not an App.
Overrides: object.__init__

See Also: Method MenuBar.main.

append(self, *menus)

 

Add one or more sub-menus to this menu bar.

Parameters:
  • menus - The menus to add (Menu).

__getitem__(self, index)
(Indexing operator)

 

Yield one or several menus by index, by slice or by title.

Parameters:
  • index - Index (int, str or slice).
Returns:
Each menu (Menu).
Raises:
  • IndexError - If index out of range or if no menu titled index exists.

main(self, app=None)

 

Make this menu bar the app's main menu.

Parameters:
  • app - The application (App or None).
Raises:
  • TypeError - If app not an App.
  • ValueError - If app missing.

menu(self, title='', dflt=None)

 

Find a menu by title.

Parameters:
  • title - The menu title to match (str).
  • dflt - Optional, default return value.
Returns:
The first matching menu (Menu) or dflt if no title match found.
Raises:
  • ValueError - No dflt provided and no title match.

menus(self)

 

Yield the menus of this menu bar.

Returns:
Each menu (Menu).

Property Details

height

Get this menu bar's height (float).

Get Method:
height(self) - Get this menu bar's height (float).