尝试从使用 tkx (Tcl/tk) 的 Perl 脚本创建独立应用程序
这是我的规格: OS X 老虎 珀尔 5.8 使用与 ActiveTcl v8.5 捆绑的 Tkx
我已经使用 PAR/pp 成功创建了具有上述配置的独立应用程序,但这不是一个完全令人满意的解决方案:
- 仍然需要安装 Tcl/Tk
- 在 Tcl/Tk 窗口中打开 默认菜单
- 每次运行应用程序时,
都会打开终端是否有其他途径可以绕过这些问题?
Here are my specs:
OS X Tiger
Perl 5.8
Using Tkx bundled with ActiveTcl v8.5
I've successfully created a standalone app with the above configuration using PAR/pp, but it's not a completely satisfactory solution:
- still requires Tcl/Tk to be installed
- opens up in a Tcl/Tk window with a default menu
- opens Terminal every time I run the application
Is there another route I can take that would bypass these issues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 ActivePerl,它应该与 Tcl 和 Tk 的共享对象捆绑在一起。这些文件是 Tcl.so 和 tkkit.so(Windows 上为 Tcl.dll 和 tkkit.dll)。您需要使用
-l
选项配置 pp 以将它们与您的独立可执行文件捆绑在一起。例如(在 Windows 上):不幸的是 PAR 无法将共享对象解压到正确的位置以便 Tkx 应用程序找到它们。您可以通过在加载 Tkx 之前设置 $ENV{PERL_TCL_DL_PATH} 来解决此问题。要使应用程序在有或没有 PAR 的情况下都可用,请使用 BEGIN 块来检测它何时在 PAR 下运行:
pp
具有-g
(或--gui
) 选项来构建没有控制台窗口的应用程序,但它仅适用于 Windows。我不知道是否有办法在 OS X 上隐藏控制台。至于在带有默认菜单的 Tcl/Tk 窗口中打开应用程序,我不知道。我怀疑这是因为您使用的是 ActiveTcl 安装而不是与 ActivePerl 捆绑在一起的共享对象。
If you're using ActivePerl it should come bundled with shared objects for Tcl and Tk. The files are Tcl.so and tkkit.so (Tcl.dll and tkkit.dll on Windows). You'll want to configure pp to bundle them with your self-contained executable using the
-l
option. For example (on Windows):Unfortunately PAR doesn't unpack shared objects in the right place for Tkx applications to find them. You can get around this by setting
$ENV{PERL_TCL_DL_PATH}
before loading Tkx. To make an application that is usable either with or without PAR, use a BEGIN block to detect when it's being run under PAR:pp
has a-g
(or--gui
) option to build applications without a console window but it only works on Windows. I don't know if there's a way to hid the console on OS X.As for the application opening in a Tcl/Tk window with a default menu, I don't know. I suspect that's because you're using the ActiveTcl installation instead of the shared objects bundled with ActivePerl.
ActiveState Perl 开发工具包具有将 Tkx 脚本绑定为正确的 OS X 应用程序的额外知识。您可以尝试一下 http://www.activestate.com/perl-dev-kit< /a>.
弹出的控制台与 Tk 中的启发式方法有关,它试图确定您是否正在交互式运行(并且在您的情况下显然是错误的)。您始终可以通过以下方式抑制其显示:
在 OS XI 上还建议:
The ActiveState Perl Dev Kit has the extra knowledge to bind Tkx scripts as proper OS X apps. You can give it a try at http://www.activestate.com/perl-dev-kit.
The console popping up has to do with heuristics in Tk that are trying to determine if you are running interactively or not (and evidently getting it wrong in your case). You can always suppress its display with:
On OS X I also recommend: