pycocoa.menus

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

# Module menus

Types Item, ItemSeparator, Menu and MenuBar, wrapping ObjC `NSMenuItem` and `NSMenu` and Keys.

Version: 25.04.07

Classes
| Item Python menu Item Type, wrapping ObjC `NSMenuItem`.
| ItemSeparator Python menu ItemSeparator Type, wrapping ObjC `NSMenuItem.separatorItem`.
| Menu Python Menu Type, wrapping ObjC `NSMenu`.
| MenuBar Python MenuBar Type, wrapping ObjC `NSMenu`.

Functions
ns2Item(ns) Get the Python instance for an `NSMenuItem`. |
title2action(title) Convert a menu item `title` to a Python callback method name. |

Variables
| __all__ = `_ALL_LAZY.menus`
| Keys = `Keys.ACK=0`...`` Menu Item shortcut keys (`chr`).
| bar = `MenuBar()`
| menu = `Menu('Test')`
| item = `Item('Quit', 'menuTerminate_', key= 'q')`
| Keys.ACK ''
| Keys.Acknowledge ''
| Keys.BEL ''
| Keys.BS ''
| Keys.BT ''
| Keys.BackSpace ''
| Keys.BackTab ''
| Keys.Bell ''
| Keys.CAN ''
| Keys.CR ' '
| Keys.Cancel ''
| Keys.CarriageReturn ' '
| Keys.DC1 ''
| Keys.DC2 ''
| Keys.DC3 ''
| Keys.DC4 ''
| Keys.DEL ''
| Keys.DLE ''
| Keys.DataLineEscape ''
| Keys.Delete ''
| Keys.DeviceControl1 ''
| Keys.DeviceControl2 ''
| Keys.DeviceControl3 ''
| Keys.DeviceControl4 ''
| Keys.EM ''
| Keys.ENQ ''
| Keys.EOT ''
| Keys.ESC ''
| Keys.ETB ''
| Keys.ETX ''
| Keys.EndOfMedium ''
| Keys.EndOfText ''
| Keys.EndOfTransmit ''
| Keys.EndOfTransmitBlock ''
| Keys.Enquiry ''
| Keys.Enter ''
| Keys.Escape ''
| Keys.FF ' '
| Keys.FS ''
| Keys.FileSeparator ''
| Keys.FormFeed ' '
| Keys.GS ''
| Keys.GroupSeparator ''
| Keys.HT ' '
| Keys.HorizontalTab ' '
| Keys.LF ' '
| Keys.LineFeed ' '
| Keys.NAK ''
| Keys.NL ' '
| Keys.NegativeAcknowledge ''
| Keys.NewLine ' '
| Keys.RS ''
| Keys.RecordSeparator ''
| Keys.SI ''
| Keys.SO ''
| Keys.SOH ''
| Keys.SP ' '
| Keys.STX ''
| Keys.SUB ''
| Keys.SYN ''
| Keys.ShiftIn ''
| Keys.ShiftOut ''
| Keys.Space ' '
| Keys.StartOfHeading ''
| Keys.StartOfText ''
| Keys.Substitute ''
| Keys.SynchronousIdle ''
| Keys.Tab ' '
| Keys.US ''
| Keys.UnitSeparator ''
| Keys.VT ''
| Keys.VerticalTab ''

Function Details

### ns2Item(ns) |
Get the Python instance for an `NSMenuItem`. Parameters: `ns` - The ObjC instance (`NSMenuItem`). Returns: The instance (Item or Menu). Raises: `TypeError` - Invalid ns type. Note: A Menu instance is returned if ns was an intermediate `NSMenuItem`, created internally to append or insert a Menu to a MenuBar.

### title2action(title) |
Convert a menu item `title` to a Python callback method name. Parameters: `title` - The item's title (`str`). Returns: Name for the Python callback method (`str`), the title with all non-alphanumeric characters except colon and underscore removed, with prefixed `"menu"` and suffix `"_"` added. Raises: `ValueError` - If title can not be converted.

Variables Details

  ### Keys Menu Item shortcut keys (`chr`). Value:
      Keys.ACK=0x6,
          .Acknowledge=0x6,
          .BackSpace=0x8,
          .BackTab=0x19,
          .BEL=0x7,
          .Bell=0x7,
          .BS=0x8,
          .BT=0x19,
      ...