删除默认的"Python" Mac OSX上带有Tkinter菜单的子菜单 [英] Remove default "Python" submenu with Tkinter Menu on Mac OSX
问题描述
在Mac OSX上的Tkinter中创建菜单时,第一个子菜单标记为"Python".有没有一种方法可以删除它,使唯一的子菜单是我创建的子菜单,或者该子菜单无论如何始终存在?
When creating a Menu in Tkinter on Mac OSX, the very first submenu is labeled "Python". Is there a way to remove this so that the only submenus are the ones that I have created or does that submenu always exist no matter what?
这是我创建菜单的方式
root = self.winfo_toplevel()
self.menu = Menu(root)
root['menu'] = self.menu
self.sub_menu = Menu(self.menu)
self.menu.add_cascade(label='My Program', menu=self.sub_menu)
self.sub_menu.add_command(label='Quit', command=self.quit)
推荐答案
我能够重命名第一个Menu标题的唯一方法是将python编译为应用程序.我使用 py2app 做到了.
The only way I've been able to rename the first Menu title is to compile the python to an application. I did this using py2app.
我有一个示例应用程序,您可以在此处查看:
I have an example app you can see here:
https://bitbucket.org/jgrigonis/mathfacts/overview
关键代码在此文件中:
https://bitbucket.org/jgrigonis/mathfacts/src/b994b6225743 /setupmac.py
这篇关于删除默认的"Python" Mac OSX上带有Tkinter菜单的子菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!