Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16445 > unrolled thread
| Started by | Detlev Offenbach <detlev@die-offenbachs.de> |
|---|---|
| First post | 2011-11-30 19:55 +0100 |
| Last post | 2011-12-11 12:20 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
How to get a correct entry in the menu for a Python application on Mac OS X Detlev Offenbach <detlev@die-offenbachs.de> - 2011-11-30 19:55 +0100
Re: How to get a correct entry in the menu for a Python application on Mac OS X Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-12-09 10:46 +1300
Re: How to get a correct entry in the menu for a Python application on Mac OS X Detlev Offenbach <detlev@die-offenbachs.de> - 2011-12-11 12:20 +0100
| From | Detlev Offenbach <detlev@die-offenbachs.de> |
|---|---|
| Date | 2011-11-30 19:55 +0100 |
| Subject | How to get a correct entry in the menu for a Python application on Mac OS X |
| Message-ID | <jb5u69$9i9$1@online.de> |
Hello, I am fairly new to Mac OS X and would like to know, what I have to do to make my Python application show the correct name in the menu bar. What did I do so far. I created an application package containing the .plist file with correct entries and a shell script, that starts the correct Python interpreter with the the main script. The menu bar just shows Python instead of the name of my application. If you are interested the application can be found via http://eric-ide.python-projects.org. Regards, Detlev -- Detlev Offenbach detlev@die-offenbachs.de
[toc] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-12-09 10:46 +1300 |
| Message-ID | <4EE13048.8090307@canterbury.ac.nz> |
| In reply to | #16445 |
Detlev Offenbach wrote:
> I am fairly new to Mac OS X and would like to know, what I have to do to
> make my Python application show the correct name in the menu bar. What
> did I do so far. I created an application package containing the .plist
> file with correct entries and a shell script, that starts the correct
> Python interpreter with the the main script.
I don't think that will work, because the executable that
your shell script is starting is in an app bundle of its
own, and MacOSX will be using the plist from that bundle,
which just has the generic "Python" name in it.
There are a couple of things you could do:
1) Use py2app to create your app bundle. It does the
right things -- not sure exactly what, but it works.
2) Hack things at run time. I use the following PyObjC
code in PyGUI to set the application name:
from Foundation import NSBundle
ns_bundle = NSBundle.mainBundle()
ns_info = ns_bundle.localizedInfoDictionary()
if not ns_info:
ns_info = ns_bundle.infoDictionary()
ns_info['CFBundleName'] = my_application_name
--
Greg
[toc] | [prev] | [next] | [standalone]
| From | Detlev Offenbach <detlev@die-offenbachs.de> |
|---|---|
| Date | 2011-12-11 12:20 +0100 |
| Message-ID | <jc23lk$9e7$1@online.de> |
| In reply to | #16880 |
I got it working by creating a symbolic link to the Python interpreter to be used in my application package and using this symbolic link to start the main Python script. Gregory Ewing wrote: > Detlev Offenbach wrote: >> I am fairly new to Mac OS X and would like to know, what I have to do >> to make my Python application show the correct name in the menu bar. >> What did I do so far. I created an application package containing the >> .plist file with correct entries and a shell script, that starts the >> correct Python interpreter with the the main script. > > I don't think that will work, because the executable that > your shell script is starting is in an app bundle of its > own, and MacOSX will be using the plist from that bundle, > which just has the generic "Python" name in it. > > There are a couple of things you could do: > > 1) Use py2app to create your app bundle. It does the > right things -- not sure exactly what, but it works. > > 2) Hack things at run time. I use the following PyObjC > code in PyGUI to set the application name: > > from Foundation import NSBundle > > ns_bundle = NSBundle.mainBundle() > ns_info = ns_bundle.localizedInfoDictionary() > if not ns_info: > ns_info = ns_bundle.infoDictionary() > ns_info['CFBundleName'] = my_application_name > -- Detlev Offenbach detlev@die-offenbachs.de
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web