Pregunta

I am programmatically creating a menu in PyObjC with this hierarchy.

NSMenu (setMainMenu on NSApplication)
- NSMenuItem(1)
  - NSMenu: "App Name"
    - NSMenuItem(1)
    - NSMenuItem(2)
    ...
- NSMenuItem(2)
  - NSMenu: "File"
    - NSMenuItem(1)
    - NSMenuItem(2)
    ...
- NSMenuItem(3)
  - NSMenu: "Edit"
    - NSMenuItem(1)
    - NSMenuItem(2)
    ...
...

However, all PyObjC app shows is a single "Python" menu, that contains items that ought to be under "App Name".

How do I make it behave?

¿Fue útil?

Solución

The "Python" menu is likely the menu from the MainMenu.nib in the Python.app application hidden in Python.framework. That application makes it possible to use GUI APIs in a command-line script without having to resort to private APIs.

The best way to get the proper behavior is to create an application bundle, either through py2app or manually.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top