python没有菜单栏怎么搞mac_有没有办法在Mac上的应用程序窗口中显示菜单栏?

I am using a Mac if that makes a difference. Is there a way to fix this?

是的,这很重要。Tk仍然不支持设置菜单样式。根据^{}:You'll notice on some recent Linux distributions that many applications show their menus at the top of the screen when active, rather than in the window itself. Tk does not yet support this style of menus.

更多详细信息…

下面写着:On Mac OS X though, there is a single menubar along the top of the screen, shared by each window. As far as your Tk program is concerned, each window still does have its own menubar; as you switch between windows, Tk will automatically take care of making sure that the correct menubar is displayed at the top of the screen. If you don't specify a menubar for a particular window, Tk will use the menubar associated with the root window; you'll have noticed by now that this is automatically created for you when your Tk application starts.

然后给我们一个提示:Because on Mac OS X all windows have a menubar, it's important to make sure you do define one, either for each window or a fallback menubar for the root window. Otherwise, you'll end up with the "built-in" menubar, which contains menus that are only intended for use when typing commands directly into the interpreter.The Tk menu command is hooked into the Mac OS X global menubar. If you want a menu without using the global menubar, you will have to write your own top level menu.

here是一个询问如何删除顶部菜单的人,以防您对在窗口上实现菜单感兴趣: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.On the Macintosh, whenever the toplevel is in front, this menu's cascade items will appear in the menubar across the top of the main monitor. On Windows and Unix, this menu's items will be displayed in a menubar accross the top of the window. These menus will behave according to the interface guidelines of their platforms

...

As noted, menubars may behave differently on different platforms. One example of this concerns the handling of checkbuttons and radiobuttons within the menu. While it is permitted to put these menu elements on menubars, they may not be drawn with indicators on some platforms, due to system restrictions.

其他可能有用的文章

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 您可以通过以下步骤在Mac的Excel开启与Python的共享权限: 1. 打开Excel并创建一个新的工作簿。 2. 点击“工具”菜单,然后选择“宏”和“安全性”。 3. 在“安全性”选项卡,选择“低”或“”安全级别,然后单击“确定”。 4. 点击“开发”菜单,然后选择“Visual Basic”。 5. 在Visual Basic编辑器,选择“工具”菜单,然后选择“引用”。 6. 在“引用”对话框,选择“Python for Mac”并单击“确定”。 7. 现在您可以在Excel使用Python了。 希望这可以帮助您解决问题! ### 回答2: 要在Mac的Excel开启与Python的共享权限,可以按照以下步骤操作: 1. 首先,确保你的Mac已经安装了Python。如果没有安装,你可以从Python官方网站(https://www.python.org/downloads/)下载并安装最新版本的Python。 2. 打开Excel,在顶部的菜单栏点击“Excel”,然后选择“偏好设置”。 3. 在偏好设置窗口,点击“常规”选项卡。在“常规”选项卡下方,找到并点击“安全性和隐私”。 4. 在“安全性和隐私”选项卡,点击“隐私”选项卡。然后,在左侧的侧边栏,找到并点击“完全磁盘访问权限”。 5. 在右侧的列表,点击“+”按钮以添加新的应用程序。 6. 在打开的对话框,导航到Python安装路径。通常,Python的安装路径是“/usr/bin/python”或“/usr/local/bin/python3”。选择正确的路径后,点击“打开”按钮。 7. 然后,在Excel的“隐私”选项卡,确保Python已被加入到“完全磁盘访问权限”列表。 8. 现在,你可以在Excel使用Python脚本了。你可以使用VBA宏或其他Excel功能来调用Python脚本,并进行数据处理、分析等操作。 需要注意的是,开启共享权限后,Excel可以与Python共享数据和代码,但同时也可能存在一些安全风险。因此,在使用Python与Excel进行共享时,要注意保护数据安全和防止恶意代码的执行。 希望以上回答对你有所帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值