Perl Tk 模块的缺点是什么? [英] What are the disadvantages of the Perl Tk module?

查看:22
本文介绍了Perl Tk 模块的缺点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与在 Perl 中创建 GUI 的其他解决方案相比,Tk 模块有哪些缺点?

What are the disadvantages of the Tk module compared to other solutions to create a GUI in Perl?

推荐答案

我最近参观了 Perl 的各种 gui 模块,这里是我的总结(免责声明:最终我发现现有的模块都不能满足我的需求,所以我开始编写我自己的 gui 工具包).

I toured the various gui modules for Perl recently, and here is my summary (disclaimer: ultimately I found that none of the existing modules met my needs so I started writing my own gui toolkit).

Tk - 体面的工作和界面非常漂亮.gui 本身看起来有点过时,并且没有利用任何操作系统的本机小部件(如文件选择器).在大多数系统上,它需要安装 C 编译器.

Tk - Decent to work with and the interface is very perlish. The gui itself is a bit dated looking, and doesnt take advantage of any of the operating system's native widgets (like filepickers). On most systems it will require a C compiler to install.

Wx - 难以使用,界面不漂亮.大型程序几乎需要一个 gui 构建器来跟踪所有内容.对操作系统级别小部件的支持是混合的.比 Tk IMO 好看.涉及编译,需要安装多个库,在windows上运行可能很困难.程序的组装非常程序化,并不能完全映射到程序的实际外观.

Wx - Difficult to work with, un-perlish interface. Large programs almost require a gui builder to keep track of everything. Support for os level widgets is mixed. Nicer looking than Tk IMO. Compilation is involved, requires installing several libraries, can be difficult to get running on windows. The assembly of programs is very procedural, and does not map cleanly to what the program will actually look like.

Qt - 上次我看这个模块或多或少被放弃了,只支持 Qt3.我没有尝试安装它,但我想它需要一个编译器.

Qt - last I looked this module was more or less abandoned and only supports Qt3. I didn't try to install it, but i imagine it needs a compiler.

Prima - 与 Tk 类似,它具有过时的外观.需要编译器.

Prima - Similar to Tk it has a dated appearance. Requires a compiler.

W32::GUI - 我很早就排除了这一点,因为它不是跨平台的.

W32::GUI - I ruled this out early since it is not cross platform.

XUL::Node/POE::XUL::Node - 包含 C 代码的相当重的依赖树.似乎没有维护,我在安装它时有不同的经历.Windows 不行,OSX 不行,它在 OpenSUSE 上的功能有限.它还只支持 XUL 语言的一个子集.

XUL::Node / POE::XUL::Node - rather heavy dependency tree that includes C code. Seems unmaintained and I had mixed experiences getting it to install. Windows was a no go, OSX was a no go, it had limited functionality on OpenSUSE. It also only supports a subset of the XUL language.

我发现现有的 gui 工具包都不能轻松地将您的应用程序分发给最终用户.期望程序员跳过解决库依赖项和编译代码的环节是可以的,但最终用户不会这样做.所以我的第一个要求是纯 Perl.

I found that none of the existing gui toolkits made it easy enough to distribute your application to end users. It is ok to expect programmers to jump through the hoops of resolving library dependencies and compiling code, but end users aren't going to do that. So the first requirement I had was to be pure Perl.

其次,几乎所有现有的 gui 工具包都迫使您以非常程序化的方式工作:创建一个容器.为容器创建一个打包程序.创建一个对象.在该对象上设置属性.将对象添加到打包程序.运行打包程序以填充容器对象.重复.

Secondly, nearly all of the existing gui toolkits force you to work in a very procedural manner: Create a container. Create a packer for the container. Create an object. Set properties on that object. Add the object to the packer. Run the packer to fill the container object. Repeat.

相反,我发现嵌套设计(如 HTML)更容易遵循,原因有两个.首先,由于对象是嵌套的,因此无需命名所有内容(label_456、label_457...).其次,程序的结构反映了显示内容的结构.

Instead, I find that nested design (like HTML) is easier to follow for two reasons. First off, since objects are nested, there is no need to name everything (label_456, label_457...). Secondly, the structure of the program mirrors the structure of what is displayed.

所以我开始了 XUL::Gui 的工作,它一直在发展相当好.它是纯 Perl,并且仅依赖于核心模块以方便安装.它有一个外部要求,即安装最新的 (3+) Firefox 副本.它使用熟悉的 Web 开发设计模式和 CSS 样式的嵌套标签.当然,您可以使用它编写功能齐全的单窗口应用程序.

So I started work on XUL::Gui, and its been coming along rather well. It is pure Perl, and only depends on core modules for ease of installation. It has one external requirement, which is that a recent (3+) copy of Firefox is installed. It uses the familiar design pattern of web development with nested tags styled with CSS. It is certainly at a level where you could write fully featured single window applications with it.

希望这能帮助您找出最适合您的项目的工具包.

Hopefully this helps you to figure out which toolkit is best for your project.

这篇关于Perl Tk 模块的缺点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆