gpt4 book ai didi

c - 在 MacOSX 上使用 Tcl/Tk C API 时,为什么它会在环境中执行?

转载 作者:太空宇宙 更新时间:2023-11-04 04:45:52 33 4
gpt4 key购买 nike

我创建了一个链接到 Tcl/Tk 的程序MacOS 10.8.5 上的库以创建跨平台 GUI。在最基本的层面上,我使用 Tcl_CreateInterp 创建了一个 Tcl/Tk 解释器。在我的程序中,我可以成功发出 Tk commands用于创建 GUI。

在 Linux 上,一切都按预期工作,并且表现为 native GUI 应用程序,但在 MacOS 上,该程序似乎在某种环境中运行。

下面你可以看到选择About菜单项后出现的启动画面,通过文件菜单判断这个环境可以通过Source...菜单执行其他脚本元素。您甚至可以在这里运行小部件演示!

知道这里发生了什么,或者我怎样才能让这个程序在没有这个环境的情况下表现得像一个普通的 GUI 应用程序?我是否缺少 Tcl/Tk 调用?

splash screen menu

最佳答案

经过进一步研究,我可以肯定地说这是 MacOS 提供的默认菜单栏。如果您创建另一个菜单并将其分配给顶层窗口,它将替换默认菜单。

这里也提到了:http://www.tkdocs.com/tutorial/menus.html

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.

关于c - 在 MacOSX 上使用 Tcl/Tk C API 时,为什么它会在环境中执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21026880/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com