将 TCL TK 转换为独立应用程序的最简单步骤

发布于 2024-08-04 02:53:48 字数 334 浏览 3 评论 0原文

在遇到了与 C#、ASP.NET、MS Access、Linux 和 Mono 的主要兼容性问题后,我决定使用一种跨平台、开源且与嵌入式数据库兼容的语言进行编程,而嵌入式数据库也与许多其他数据库兼容。平台。我把选择范围缩小到TCL。

在开始使用 TCL 制作示例应用程序之前,我想看看创建独立应用程序有多么容易。我购买了一本名为“TCL 和 TK 中的实用编程”的书,下载了 TCLkit 和 FreeWrap,但我在寻找将 TK (Wish) 中的 TCL 转换为独立应用程序的方法时遇到了困难。

是否有人能够提供简单的步骤来将 TCL TK 脚本(例如带有文本的标签)转换为应用程序或具有相当直接解释的 Web 资源?

After running into major compatitiblity problems with C#, ASP.NET, MS Access, Linux, and Mono, I've decided to program in a language that is cross-platform, open source, and compatible with embedded databases that are also compatible with many platforms. I narrowed my choice down to TCL.

Before I began a sample application with TCL, I wanted to see how easy it was to create a stand alone application. I purchased a book entitled "Practical Programming in TCL and TK", downloaded TCLkit, and FreeWrap, yet I am having troubles finding a methodological way to convert TCL in TK (Wish) into a standalone application.

Would anyone be able to provide simple steps towards converting a TCL TK script, such as a label with text on it, into an application, or a web resource that has a pretty straight forward explanation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一个人的夜不怕黑 2024-08-11 02:53:48

要构建 starpack,您需要 a) tclkit 运行时,b) sdx.kit。您还需要一个“basekit”,它将与您的 tcl 代码一起打包的可执行文件。对于此示例,我假设您正在为正在运行的同一平台创建应用程序。您可以通过简单地将 tclkit(或 Windows 上的 tclkit.exe)复制到另一个名称(例如“basekit”)来创建 Basekit。

% ls
sdx.kit tclkit
% cp tclkit basekit
% ls
basekit sdx.kit tclkit

现在,创建您想要包装到可执行文件中的代码。约定是使用应用程序名称和后缀“.vfs”(表示“虚拟文件系统”)创建一个目录,然后在该目录中创建一个名为“main.tcl”的文件:

% mkdir myapp.vfs
% cat > myapp.vfs/main.tcl
package require Tk
label .l -text "Hello, world"
pack .l
^D
% ls myapp.vfs
main.tcl

现在进行包装:您将需要 sdx.kit 文件。假设它和 tclkit(或 tclkit.exe)位于您当前的工作目录中,您可以像这样包装您的应用程序:

% ./tclkit sdx.kit wrap myapp -runtime basekit
1 updates applied
% ls 
basekit myapp myapp.vfs sdx.kit tclkit

wrap 命令知道您何时给它参数“myapp”,它应该包装 myapp.vfs 的内容,并且它应该在该目录中查找名为“main.tcl”的文件作为程序入口点。您可以将您想要的任何其他文件放入该目录中,它们都会被打包,包括特定于平台的二进制文件、图像文件和您想要打包的任何其他文件。

您现在有一个可执行文件“myapp”,它是包装的应用程序。

如果您有适用于不同体系结构的 tclkit,则可以使用它们(将命令行上的“basekit”替换为目标体系结构的工具包)来为其他平台进行交叉编译。

有关详细信息,请参阅 如何创建我的第一个 Starpack。 tcl.tk/" rel="noreferrer">Tcl'ers Wiki

To build a starpack you need a) a tclkit runtime, b) sdx.kit. You also need a "basekit", the executable that will be wrapped with your tcl code. For this example I'll assume you're creating an application for the same platform you are running on. You can create a basekit by simply copying tclkit (or tclkit.exe on windows) to another name, such as "basekit"

% ls
sdx.kit tclkit
% cp tclkit basekit
% ls
basekit sdx.kit tclkit

Now, create the code that you want to have wrapped into an executable. The convention is to create a directory with the name of your app and the suffix ".vfs" (for 'virtual file system'), then create a file named 'main.tcl' in that directory:

% mkdir myapp.vfs
% cat > myapp.vfs/main.tcl
package require Tk
label .l -text "Hello, world"
pack .l
^D
% ls myapp.vfs
main.tcl

Now to do the wrapping: for this you'll need the sdx.kit file. Assuming it and tclkit (or tclkit.exe) are in your current working directory, you wrap your app like this:

% ./tclkit sdx.kit wrap myapp -runtime basekit
1 updates applied
% ls 
basekit myapp myapp.vfs sdx.kit tclkit

The wrap command knows when you give it the argument "myapp" that it should wrap the contents of myapp.vfs, and that it should look for a file named "main.tcl" in that directory to be the program entry point. You can put whatever other files you want in that directory and they will all be wrapped, including platform-specific binary files, image files and anything else you want bundled up.

You now have an executable file, 'myapp', that is the wrapped application.

If you have the tclkits for different architectures you can use them (replacing 'basekit' on the command line with the kit for the target architecture) to cross-compile for other platforms.

For more information see How to create my first Starpack on the Tcl'ers Wiki

与君绝 2024-08-11 02:53:48

kitgen 构建系统 也可能在开始时为您提供帮助。

kitgen build system may also help you at the beginning.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文