PyQt 或 PySide - 使用哪一个 [英] PyQt or PySide - which one to use

查看:89
本文介绍了PyQt 或 PySide - 使用哪一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习一些 Python,现在想玩玩 gui-building.Qt 似乎是一个不错的选择,因为它具有跨平台性.
现在似乎有两种绑定可用:Riverbank Computing 的 PyQt 和最初由诺基亚开发的 PySide.
那么我应该选择哪一个呢?我所能找到的只是两年前的功能比较,但现在有什么区别?
哪一个更容易使用,有更多/更好的文档?两者都还在积极开发中吗?
由于我不打算编写商业应用程序,因此许可对我来说并不重要.

I started learning a bit of python and would now like to toy around a bit with gui-building. Qt seems to be a good choice because of its cross-platformishness.
Now there seem to be two bindings available: PyQt by Riverbank Computing and PySide, originally developed by Nokia.
So which one should I choose? All I can find are two year old feature comparisons, but what differences are there nowadays?
Which one is easier to use, has more/better documentation? Are both still in active development?
Licensing isn't of much concern to me since I don't intend to write commercial applications.

推荐答案

这两个工具包都得到了积极维护,现在在功能和质量上或多或少是相同的.只有很少的,相当不重要的差异.

Both toolkits are actively maintained, and by now more or less equal in features and quality. There are only few, rather unimportant differences.

不过,我还是推荐 Python 2 的 PySide.它有一个更合理的 API,主要是它不公开 Qt 类型,这些类型在 Python 中有直接的等价物(例如 QString、QList 等)或完全由于 Python 的动态特性,如 QVariant,这是多余的.这避免了与 Qt 类型之间的许多繁琐的转换,从而简化了编程并避免了许多错误.

Still, I'd recommend PySide for Python 2. It has a more reasonable API, mainly it doesn't expose Qt types, which have a direct equivalent in Python (e.g. QString, QList, etc.) or which are completely superfluous due to Python's dynamic nature, like QVariant. This avoids many tedious conversions to and from Qt types, and thus eases programming and avoids many errors.

PyQt 也支持这种现代 API,默认情况下将其用于 Python 3,但不用于 Python 2 以保持向后兼容性.

PyQt also supports this modern API, and uses it by default for Python 3, but not for Python 2 to maintain backwards compatibility.

这篇关于PyQt 或 PySide - 使用哪一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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