“铁蟒” .NET”与“Python”相比PyQt”。哪一种更适合Windows App开发?
我是Python 的新手。我想使用 Python 开发 Windows GUI 应用程序。经过一番研究,我发现我有 2 个选择:-
- IronPython + .NET Framework
- Python + PyQt
我可以知道哪一个更适合 Windows 应用程序开发吗?哪个选项具有更多功能(例如数据库支持等)?
除了.NET 支持之外,IronPython 和 Python 之间还有什么大的区别吗?哪一个对我来说是更好的选择?
谢谢。
帕特里克·L
I'm new in using Python. I would like to develop Windows GUI Application using Python. After some research, I found that I have 2 options:-
- IronPython + .NET Framework
- Python + PyQt
May I know which one is better for Windows Application development? Which option has more features (e.g. database support, etc)?
Other than the .NET support, is there any big difference between IronPython and Python? Which one is a better choice for me?
Thank you.
Patrick.L
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我遇到了同样的问题,并带着疑虑决定使用 IronPython/C#/.Net。我喜欢 Qt,但当它被卖给诺基亚时我却临阵退缩,因为我不确定诺基亚拥有 Qt 的目标是否与我对 Windows UI 的需求一致。也就是说,诺基亚已经采取了一些积极举措,将单独的平台许可合并为单一许可,并放弃 GPL 许可,转而采用 LGPL。
从技术上讲,Qt 设计良好,但严重依赖于难以调试的 C# 宏。我不知道为什么。 Qt 最好的一点是它是开源的。如果需要,您可以修复它。我没有直接使用 PyQt 的经验,但它已经存在很长一段时间了。
.Net 就是 .Net,和 Microsoft 一样,它是一个不断变化的目标。为了便于编码,您将牺牲速度。 IronPython 小组看起来不错,但我不确定微软是否有承诺。尽管计划听起来不错,但尚未提供 Visual Studio 支持。毕竟,MS 只关心他们是否拥有一切,而 Python 则不然。我真正期望的是 MS 将创建一个动态版本的 C#、解释器等,并告诉所有 Python 程序员,它更好、受支持并且与 .Net 集成得更好。然后,他们将像对待 Java 一样,发挥巨大的力量来压垮 Python。
祝你好运。这是一个重大决定。
I faced the same issue and have, with misgivings, decided to go with IronPython/C#/.Net. I liked Qt but got cold feet when it was sold to Nokia because I just wasn't sure Nokia's goals in owning Qt were consistent with my needs for a windows UI. That said, Nokia has made some positive moves by combining separate platform licenses into a single license and dropping GPL licensing in favor or LGPL.
Technically, Qt is well designed but relies heavily on hard to debug C# macros. I'm not sure why. The best thing about Qt is that it is open source. If you need to, you can fix it. I don't have direct experience with PyQt but it has been around for quite a while.
.Net is .Net and as usual with Microsoft, a moving target. You will sacrifice speed for ease of coding. The IronPython group seems good but I'm not sure if Microsoft's commitment is there. Visual Studio support isn't there yet although the plans sound good. After all, MS only really cares if they own everything, which is not the case for Python. What I really expect is MS will create a dynamic version of C#, interpreter and all, and tell all the Python programmers that it is better and supported and well integrated with .Net. They will then through their considerable weight behind crushing Python like they've done to Java.
Good luck. It's a big decision.
首先,有超过 2 个选项(Python 有更多的 GUI 库,多得你无法想象),但让我们先讨论一下你的前提。 “更好”是主观的,这就引出了一个问题:“你想学什么?”
如果目标是 Windows GUI 应用程序开发,那么我会选择 .Net。 .Net 很受尊重,.Net 程序员有很多工作要做,而且它以 Windows 为中心的性质(是的,我知道有 Mono,但仍然如此)意味着您不必考虑三组以上用户期望的细节。
如果目标是学习广泛使用的 Python 库和技术,我会选择 PyQt(最近也是这样做的)。它是跨平台的,备受推崇,并且拥有庞大的社区。但作为该项目的一部分,您失去了学习 .Net 平台的机会。
我认为如果你的目标是学习,你就不会放松。如果您的目标是完成某件事,请考虑该项目的长期计划以及其长期发展方向。您想要一些可以很好地集成到 Windows 用户界面中并使用标准小部件的东西吗?您想要将来可以轻松适应其他平台的东西吗?
First, there are lots more than 2 options (python has more GUI libraries than you can shake a stick at), but let's go on your premise for a minute. "Better" being subjective begs the question: "what do you want to learn?"
If the goal is Windows GUI Applications development, than I'd go with .Net. .Net is well respected, there is lots of work for .Net programmers, and it's windows centric nature (yeah I know there's Mono but still) means you aren't trying to think about details of three+ sets of user expectations.
If the goal is to learn widely used Python libraries and techniques, I'd go with PyQt (and recently did). It's cross-platform, well respected, and has a large community. But you lose the chance to learn the .Net platform as part of this project.
I don't think you can loose either way if your goal is to learn. If your goal is to get something done, think about the long-term plans for the project and where its going over the long run. Do you want something that's well integrated into the Windows user-interface, and uses standard widgets? Do you want something that can easily be adapted to other platforms in the future?
根据我对 PyQt(作为 Qt 的接口)和 IronPython(作为 WinForms 的接口)的使用,包是混合的。
两者基本上都是底层平台的“绑定”。 PyQt 实际上是从 Qt 的 API“自动生成”的,并且由于在 Linux 上的大量使用,作为包装器稍微“成熟”一些。
IronPython 更深入一些,似乎“重新装箱”了 cPython 和 .Net 库(gzip、zip、子进程等)之间未填补的小间隙的系统对象。
在这两种情况下,您都需要仔细研究 Python 工具包并告诉自己是否喜欢该工具包。 python 所做的就是将工具包的 API 重新打包到对象中。再次忘记 Python 方面。查看底层工具包 API,并思考您是否可以接受它。
我个人认为 Qt 的 API 的 C++ 性质太不符合 Python 风格,因此无法对其感到满意。 C# 和 Python 非常相似,如果您从 C# 中删除花括号和类型声明,您将不知道它是 C# 还是 Python。因此,对于 Python 程序员来说,MSDN 和其他地方提供的基于 C# 的 .Net API、代码和示例只需进行很小的调整即可立即应用。
最后,更正确的比较是 PyQt(cPython 的 Qt 绑定)和 Win32py(cPython 的 Windows ABI 绑定)之间的比较。 IronPython 几乎是在不同平台上对同一种语言的重新发明,但也存在随之而来的所有问题(缺乏功能)。
Per my play with both PyQt (as interface to Qt) and IronPython (as an interface to WinForms) the bag is mixed.
Both are basically "bindings" for underlying platforms. PyQt is practically "autogenerated" from Qt's API and slightly more "mature" as a wrapper because of significant use on Linux.
IronPython goes a little deeper and seems to "rebox" system objects with small unfilled gaps between cPython and .Net libs (gzip, zip, subprocess etc).
In both cases, you need to look through Python into the toolkit and say to yourself if you like the toolkit. All python is doing is repackaging the toolkit's API to the objects. Again, forget about Python aspect. Look at the underlying toolkit API and think to yourself if you can live with that.
I personally find the C++ nature of Qt's API too un-pythonic to be happy with it. C# and Python are so alike that if you remove curlies and type declaration from C# you would not know if it's C# or Python. As a result, for a Python programmer, C#-based .Net API, code and examples as provided in MSDN and elsewhere are instantly applicable with very minor tweaks.
In the end, a more correct comparison would be between PyQt (Qt bindings for cPython) and Win32py (Windows ABI bindings for cPython). IronPython is almost a reinvention of same language on a different platform, with all the problems (lacking functionality) that comes with that.
PyQt 是一个很棒的库,但 .NET 是 Windows 的最佳选择。这是因为您可以使用 C# 能够在 Python 中使用的任何 GUI 控件。此外,除了WinForms之外,IronPython也可以用来创建WPF应用程序,看起来不错。
主要区别在于功能,PyQt具有更多的跨平台功能,而.NET在Windows中绝对具有优势。
PyQt is a great library, but .NET is the best way to go for Windows. That is because you can use any GUI controls that C# would be able to use in Python. Furthermore, in addition to WinForms, IronPython can be used to create WPF applications, which look good.
The main difference is the features, and PyQt has more cross-platform features, and .NET definitely has the edge in Windows.
我没有将 IronPython 与 .NET 一起使用,但我编写了很多 PyQt 代码。根据我的经验,PyQt 是一个很棒的库。它与 Qt 执行得非常好,Qt 是一个非常知名且广泛使用的库。
由于您正在编写标准 Python,因此除了使用 PyQt 导入的几个有用的 Qt 模块之外,您还可以享受为您提供大量功能的所有 Python 标准库。编写 PyQt 代码非常高效,而且 GUI 非常漂亮且响应灵敏。而且您不能忽视可移植性的好处:只需进行最微小的修改(如果有的话),您就可以在 Linux 上运行这些程序,并且它们将正常工作。
I haven't used IronPython with .NET, but I have written a lot of PyQt code. From my experience, PyQt is a great library. It is a very well executed bindings to Qt, which is a very well known and widely used library.
Since it's standard Python you're writing, you can enjoy all the Python standard library which gives you a ton of capabilities, in addition to several useful Qt modules imported with PyQt. Writing PyQt code is productive, and the GUIs come out pretty and responsive. And you can't ignore the portability benefit: with just the tiniest modifications, if any, you can just run these programs on Linux and they will just work.