I've made a .app with my WxPython script, and it's just about finished. The problem is, the menu bar title reads "Python". How can this be changed? Would I use wx.Menu()/wx.MenuBar(), or is this a problem with the .app file itself?
Asked
Active
Viewed 1,551 times
3
-
Have you already tried calling `SetAppName` on the app object? This should be the name that appears as the name of the application menu, and in the About menu item (if you used the default), and as the name of your Dock icon, and so on. (You also might want to try logging the result of `GetAppName` to make sure it hasn't somehow changed back to `"Python"` after you thought you'd set it.) – abarnert Sep 28 '12 at 03:44
-
1Tried this after my `app = wx.PySimpleApp`: `app.SetAppName('MyName')`. Didn't work, unfortunately. – tkbx Sep 28 '12 at 03:57
-
One more thing: Do you have a custom Info.plist? If not, that may be all you need—take the stock one, change CFBundleName, and see what happens. (Sorry I'm just guessing here; it's been a long time since I used wx…) – abarnert Sep 28 '12 at 04:01
-
One last guess: Are you using `py2app`, or the old-style `BundleBuilder` or whatever it was called that came with older versions of wxPython? If so, switch to `py2app`. That may require a couple other minor changes, but the wxPython documentation explains pretty clearly everything you need. – abarnert Sep 28 '12 at 04:03
-
@abarnert yes, that was already set. Seems it should be simple enough, but everything that _should_ work doesn't – tkbx Sep 28 '12 at 04:03
-
@abarnert I created my own .app, added the folders, binary, resources, etc. py2app seems like a better option, but I don't see what the difference would be. Will try it... – tkbx Sep 28 '12 at 04:05
-
OK, one more thing: Go to http://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X and try to build the sample there. If it ends up with "Python" instead of "MyAppName" for the app menu title, you're probably hosed. If not, then you have something to compare against to see what's different. PS, one difference is that `py2app` creates a `__boot__.py` wrapper around your main script that does some crufty setup stuff so you don't have to. No idea whether any of that is relevant to your problem, but it could be. – abarnert Sep 28 '12 at 04:06
-
@abarnert sigh, `NameError: name 'setup' is not defined` in my py2app script. I copied it _exactly_. – tkbx Sep 28 '12 at 04:14
-
You get that error when doing the sample from the wxPython wiki page? Or you've copied and pasted various things from it into your project? – abarnert Sep 28 '12 at 04:16
-
@abarnert I copied it and replaced names, filenames, and the app identifier with my own. Then, I discovered I was supposed to add `from setuptools import setup`. Built, and the name works fine (YAY), but I now get "no available 64 bit architecture". EDIT: Is this specific to my install (I can just use "open in 32-bit"), or is this a script problem? – tkbx Sep 28 '12 at 04:19
-
We're getting pretty far off the original topic now; you might want to open a different question for how to debug the 64-bit problem. (My first guess is that you've pulled in some framework or lib that you only have a 32-bit build of, but your executable is universal. And again, the first step is to try to build the py2app sample from that page and see if it works or has the same problem. Also, there should be a longer error message than that, which tells you which image has no 64-bit in it, which would really help.) – abarnert Sep 28 '12 at 06:32
2 Answers
6
Be sure to use Py2app, and make sure the .plist is filled out correctly, IE CFBundleName and CFBundleDisplayName.

tkbx
- 15,602
- 32
- 87
- 122
-2
Edit: My old answer does not work.
This question is related to yours, though they are asking about QT: Setting Mac OSX Application Menu menu bar item to other than "Python" in my python Qt application
A basic summary: You can't do it with the python code. You must create an application bundle. One of the answers at that post links to a basic how-to.
Also, have a look at py2app: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html

Community
- 1
- 1

korylprince
- 2,969
- 1
- 18
- 27
-
1No. OS X has a system-wide menubar at the top of the screen, controlled by the current foreground app, rather than a menubar on each window. The title of the window is irrelevant. – abarnert Sep 28 '12 at 03:37
-
He's already creating a .app bundle (presumably with `py2app`, although he didn't say), so the new answer doesn't help either. – abarnert Sep 28 '12 at 04:02
-
-
Yes he did. The first words of his question are: "I've made a .app with my wxPython script." – abarnert Sep 28 '12 at 04:15
-
Sorry. I thought you said he was using py2app, which he still hasn't verified. I'm able to build an app with py2app that will set the Menu Title just fine, so my guess is that he isn't using py2app. – korylprince Sep 28 '12 at 04:18