OS X Menubar in Tkinter

Ned Deily nad at acm.org
Sun Oct 19 20:49:09 EDT 2014


In article <a876c046-18aa-4332-bc9a-b1d1181f2b4c at googlegroups.com>,
 Noble Bell <noblebell at gmail.com> wrote:
> I am using Python 3.4 on Mac OS X and Tinter 8.5. Does anyone have any code 
> that they would share with me on how to remove the "Python" menu in the 
> menubar at the top next to the "apple'? 
> 
> I would like to have the name of my program there instead and my menu. I can 
> add menus but not sure how to do the special menubar. Any help would be 
> appreciated.

The name that shows up in the menu is derived by OS X from the 
application name in the executing application bundle.  If you don't 
package your program up as an OS X application bundle, defaults will be 
used; in the case of Python OS X framework builds, Python provides a 
Python.app within the framework to allow the Python process to be 
automatically promoted to a full OS X gui process.  Probably the 
simplest approach is to use py2app to create a double-clickable app with 
the name you want.  There's an example in an answer to a similar 
question on Stackoverflow.  And there are some old but still relevant 
details documented in the Tcl/TkAqua FAQ.

https://pypi.python.org/pypi/py2app
http://stackoverflow.com/questions/8695926/remove-default-python-submenu-
with-tkinter-menu-on-mac-osx
http://wiki.tcl.tk/12987

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list