문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top