OS X Menubar in Tkinter

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Oct 20 02:47:38 EDT 2014


Ned Deily wrote:
> The name that shows up in the menu is derived by OS X from the 
> application name in the executing application bundle.

I found a hackish way to change it at run time while
working on PyGUI, but it requires using PyObjC:

   from Foundation import NSBundle

   def change_application_name(new_name):
     #  Arrange for the application name to be used as the title
     #  of the application menu.
     ns_bundle = NSBundle.mainBundle()
       if ns_bundle:
         ns_info = ns_bundle.localizedInfoDictionary()
         if not ns_info:
           ns_info = ns_bundle.infoDictionary()
         if ns_info:
           if ns_info['CFBundleName'] == "Python":
             ns_info['CFBundleName'] = new_name

-- 
Greg



More information about the Python-list mailing list