[Pythonmac-SIG] Getting control over the Apple menu
Ned Deily
nad at acm.org
Thu Nov 1 17:00:09 CET 2012
In article <509308E1-ED1E-4CCB-8EFE-F672E2B97702 at mac.com>, wrw at mac.com
wrote:
> On Nov 1, 2012, at 10:43 AM, Kevin Walzer <kw at codebykevin.com> wrote:
> > On 11/1/12 9:37 AM, wrw at mac.com wrote:
> >> When running the script directly in the interpreter, that is, when I
> >> invoke is as $ ./CM_GUI_2.py in a terminal window (or as $ python
> >> CM_GUI_2.py) the first menu to the right of the Apple icon (the one I'd
> >> call the Application menu) remains named "Python" - although the menu
> >> under it now includes the items I've created.
> >
> > That's expected behavior. The application name in the app menu corresponds
> > to the actual executable that is running the app. When you run the app in
> > Terminal, the executable is Python. When it's wrapped with py2app, the
> > executable is the actual app name (actually, the stub executable created by
> > py2app, but which is renamed to match your app). You shouldn't expect to
> > see anything but what you are seeing.
> Good - that's pretty much what I deduced after thinking about your answer
> last night. Then Ned's post made me scratch my head.
Sorry for the confusion. I interpreted your previous post to mean that
using the 'apple' menu didn't behave the same in both cases, i.e. extra
menu cascade. To expand on the app name a bit, the application name
displayed in the menu comes from the Info.plist of the app bundle under
which your Python script is running. With a standard framework build of
Python, there is a Python.app bundle included in the Python framework so
that OS X treats the execution as from a full-blown app and certain gui
features work. That Python.app bundle has the name "Python" in the
plist. py2app, of course, creates a custom app bundle including an
Info.plist with the app name you specify.
--
Ned Deily,
nad at acm.org
More information about the Pythonmac-SIG
mailing list