用于部署Python应用程序的跨平台GUI工具包
基于:
http://www.reddit。 com / r / Python / comments / 7v5ra / whats_your_favorite_gui_toolkit_and_why /
1-设计/集成容易-学习曲线
1 - ease of design / integration - learning curve
2-* nix,Windows,Mac的支持/可用性,本地L& f的加分,对移动或网络的支持
2 - support / availability for *nix, Windows, Mac, extra points for native l&f, support for mobile or web
3- pythonic API
3 - pythonic API
4-文档质量-我想做一些更复杂的事情,现在怎么办?
4 - quality of documentation - I want to do something a bit more complicated, now what?
5-重量轻的包装不需要包括完整的安装程序(py2exe,py2app理想情况下可以按原样运行,并且不会生成庞大的MBs文件)
5 - light weight packaging so it's not necessary to include a full installer (py2exe, py2app would ideally work as-is and not generate a gazillion MBs file)
6-许可
7-其他? (请指定)
7 - others? (specify)
1-tkinter,目前受支持(从2.6,3.0开始)
1 - tkinter, as currently supported (as of 2.6, 3.0)
2-pyttk库
3-pyGTK
4-pyQt
5-wxPython
5 - wxPython
6-HTML-CGI通过基于Python的框架(Django,Turbogears,web.py,Pylons ...)或粘贴
6 - HTML-CGI via Python-based framework (Django, Turbogears, web.py, Pylons...) or Paste
7-其他? (请指定)
7 - others? (specify)
请不要犹豫,扩大答案。
Please don't hesitate to expand this answer.
Tkinter是python随附的工具包。这意味着您已经具备编写GUI所需的一切。这也意味着,如果您选择分发程序,则其他人很可能已经拥有了运行程序所需要的东西。
Tkinter is the toolkit that comes with python. That means you already have everything you need to write a GUI. What that also means is that if you choose to distribute your program, most likely everyone else already has what they need to run your program.
Tkinter既成熟又稳定,并且是(至少可以说)非常容易使用。我发现它比wxPython更容易使用,但是显然这有点主观。
Tkinter is mature and stable, and is (at least arguably) quite easy to use.I found it easier to use than wxPython, but obviously that's somewhat subjective.
Tkinter看起来丑陋且过时,因此受到了不好的说唱。使用Tkinter创建丑陋的GUI确实很容易,但是创建美观的GUI也很容易。 Tkinter不会握住您的手,但也不会很碍事。 Tkinter在Mac和Windows上看起来最好,因为它在那里使用了本机窗口小部件,但在Linux上看起来也不错。
Tkinter gets a bad rap for looking ugly and out of date. While it's true that it's easy to create ugly GUIs with Tkinter, it's also pretty easy to create nice looking GUIs. Tkinter doesn't hold your hand, but it doesn't much get in the way, either. Tkinter looks best on the Mac and Windows since it uses native widgets there, but it looks OK on linux, too.
关于Tkinter外观的另一点是,在大多数情况下,外观并不像人们想象的那么重要。用工具包编写的大多数应用程序(例如Tkinter,wxPython,PyQT等)都是特殊用途的应用程序。对于这些工具包所用于的应用程序类型,可用性胜过一切。如果应用程序的外观很重要,则可以轻松地完善Tkinter应用程序。
The other point about the look of Tkinter is that, for the most part, look isn't as important as people make it out to be. Most applications written with toolkits such as Tkinter, wxPython, PyQT, etc are special-purpose applications. For the types of applications these toolkits are used for, usability trumps looks. If the look of the application is important, it's easy enough to polish up a Tkinter application.
Tkinter具有一些其他工具包无法比拟的功能。变量轨迹,命名字体,几何(布局)管理器以及Tkinter处理事件的方式仍然是判断其他工具包所依据的标准。
Tkinter has some features that other toolkits don't come close to matching. Variable traces, named fonts, geometry (layout) managers, and the way Tkinter processes events are still the standard to which other toolkits should be judged.
缺点是,Tkinter是Tcl解释器的包装,该解释器在python内部运行。对于使用Tkinter进行开发的任何人来说,这几乎是看不见的,但是有时会导致暴露此体系结构的错误消息。抱怨一个名称为 .1245485.67345的窗口小部件时会出错,除非您也熟悉Tcl / tk的工作原理,否则对任何人来说几乎没有任何意义。
On the downside, Tkinter is a wrapper around a Tcl interpreter that runs inside python. This is mostly invisible to anyone developing with Tkinter, but it sometimes results in error messages that expose this architecture. You'll get an error complaining about a widget with a name like ".1245485.67345" which will make almost no sense to anyone unless you're also familiar with how Tcl/tk works.
另一个缺点是,Tkinter的预构建窗口小部件数量不及wxPython。例如,Tkinter中的分层树小部件有些薄弱,并且没有内置的表格小部件。另一方面,Tkinter的画布和文本小部件非常强大且易于使用。但是,对于大多数类型的应用程序,您都会编写所需的一切。只是不要期望使用Tkinter复制Microsoft Word或Photoshop。
Another downside is that Tkinter doesn't have as many pre-built widgets as wxPython. The hierarchical tree widget in Tkinter is a little weak, for example, and there's no built-in table widget. On the other hand, Tkinter's canvas and text widgets are extremely powerful and easy to use. For most types of applications you will write, however, you'll have everything you need. Just don't expect to replicate Microsoft Word or Photoshop with Tkinter.
我不知道Tkinter的许可证是什么,我认为与整个python的许可证相同。 Tcl / tk具有BSD样式的许可证。
I don't know what the license is for Tkinter, I assume the same as for python as a whole. Tcl/tk has a BSD-style license.
它是基于 Qt (一种C ++框架)构建的。它非常先进,并且具有Qt Designer等一些好的工具来设计您的应用程序。不过,您应该知道,它听起来并不像Python 100%,但接近它。 文档非常好
It's build on top of Qt, a C++ framework. It's quite advanced and has some good tools like the Qt Designer to design your applications. You should be aware though, that it doesn't feel like Python 100%, but close to it. The documentation is excellent
这个框架真的很好。它由诺基亚拥有的Trolltech积极开发。 Python的绑定由Riverbank开发。
This framework is really good. It's being actively developed by Trolltech, who is owned by Nokia. The bindings for Python are developed by Riverbank.
PyQt可根据GPL许可或商业许可获得。每个开发人员获得河岸PyQt许可证的价格约为400欧元。
PyQt is available under the GPL license or a commercial one. The price of a riverbank PyQt license is about 400 euro per developer.
Qt不仅是GUI框架,而且还有很多其他类,可以创建一个仅使用Qt类进行应用程序。 (例如SQL,网络,脚本等)
Qt is not only a GUI-framework but has a lot of other classes too, one can create an application by just using Qt classes. (Like SQL, networking, scripting, …)
Qt用于在每个平台上模拟GUI元素,但现在使用平台的本机样式(尽管不是本机GUI工具包):请参阅 Mac OS X文档和 Windows XP风格
Qt used to emulate GUI elements on every platform but now uses native styles of the platforms (although not native GUI toolkits): see the documentation for Mac OS X and the windows XP style
包装就像运行py2exe或pyInstaller一样简单。我的PyQt应用程序的内容在Windows上看起来像这样(我已在其顶部使用InnoSetup进行了正确安装):
Packaging is as simple as running py2exe or pyInstaller. The content of my PyQt app looks like this on windows (I have used InnoSetup on top of it for proper installation):
pyticroque.exe PyQt4.QtGui.pyd unicodedata.pyd
MSVCP71.dll PyQt4._qt.pyd unins000.dat
MSVCR71.dll python25.dll unins000.exe
PyQt4.QtCore.pyd sip.pyd _socket.pyd
QT带有窗口小部件设计器,甚至在最新版本中都带有 IDE 来帮助设计Qt软件。
QT comes with a widget designer and even in recent versions with an IDE to help design Qt software.
PySide是与Qt绑定的LGPL。
PySide is a LGPL binding to Qt. It's developed by nokia as a replacement for the GPL PyQt.
尽管它基于与现有$ b $不同的
技术,但它是由诺基亚开发的。 b GPL许可的PyQt绑定,PySide
最初将旨在使其与
API兼容。除了与PyQt兼容的API中的
之外,在
将来还会提供更多的
Pythonic API。
Although based on a different technology than the existing GPL-licensed PyQt bindings, PySide will initially aim to be API-compatible with them. In addition to the PyQt-compatible API, a more Pythonic API will be provided in the future.
wxPython
wxPython是一个使用 wxWidgets -Framework为Python进行绑定。该框架由LGPL许可,由开源社区开发。
wxPython
wxPython is a binding for Python using the wxWidgets-Framework. This framework is under the LGPL licence and is developed by the open source community.
我真正缺少的是设计界面的好工具,它们大约有3个
What I'm really missing is a good tool to design the interface, they have about 3 but none of them is usable.
我应该提到的一件事是,尽管我没有使用任何高级功能,但在选项卡视图中还是发现了一个错误。 (仅在Mac OS X上)我认为 wxWidgets 不如 Qt 。
One thing I should mention is that I found a bug in the tab-view despite the fact that I didn't use anything advanced. (Only on Mac OS X) I think wxWidgets isn't as polished as Qt.
wxPython实际上仅与GUI类有关,没有太多
wxPython is really only about the GUI-classes, there isn't much else.
wxWidgets使用本机GUI元素。
wxWidgets uses native GUI elements.
wxPython与Tkinter相比的一个优势是wxPython有很多功能较大的小部件库可供选择。
An advantage wxPython has over Tkinter is that wxPython has a much larger library of widgets from which to choose from.
我对其他GUI框架没有任何经验,也许其他人也没有。
I haven't got any experience with other GUI frameworks, maybe someone else has.