[英]Python + QT, Windows Forms or Swing for a cross-platform application?
I'd like to develop a small/medium-size cross-platform application (including GUI). 我想开发一个小型/中型跨平台应用程序(包括GUI)。
My background: mostly web applications with MVC architectures, both Python (Pylons + SqlAlchemy) and Java (know the language well, but don't like it that much). 我的背景:主要是带有MVC架构的Web应用程序,包括Python(Pylons + SqlAlchemy)和Java(熟悉语言,但不太喜欢它)。 I also know some C#.
我也知道一些C#。 So far, I have no GUI programming experience (neither Windows Forms, Swing nor QT).
到目前为止,我没有GUI编程经验(Windows Forms,Swing和QT)。
I plan to use SQLite for data storage: It seems to be a nice cross-platform solution and has some powerful features (eg full text search, which SQL Server Compact lacks). 我计划使用SQLite进行数据存储:它似乎是一个很好的跨平台解决方案,并且具有一些强大的功能(例如,SQL Server Compact缺少的全文搜索)。
I have done some research and these are my favorite options: 我做了一些研究,这些是我最喜欢的选择:
1) QT, Python (PyQT or PySide), and SQLAlchemy 1)QT,Python(PyQT或PySide)和SQLAlchemy
pros: 优点:
cons: 缺点:
2) .NET/Mono, Windows Forms, C#, (Fluent) NHibernate, System.Data.SQLite 2).NET / Mono,Windows Forms,C#,(流畅)NHibernate,System.Data.SQLite
pros: 优点:
cons: 缺点:
3) JVM, Java + Jython, Swing, SQLAlchemy 3)JVM,Java + Jython,Swing,SQLAlchemy
(I'm emotionally biased against this one, but listed for completeness sake) (我在情绪上偏向于这个,但为了完整性而列出)
pros: 优点:
cons: 缺点:
(Options that I have ruled out... just to avoid discussion on these): (我排除的选项......只是为了避免对这些问题的讨论):
- wxWidgets/wxPython (now that QT is LGPLed) - wxWidgets / wxPython(现在QT是LGPLed)
- GTK/PyGTK - GTK / PyGTK
The look and feel of the final application is very important to me. 最终应用程序的外观对我来说非常重要。 The above technology stacks are very different (PyQT, .NET WinForms, JVM Swing) and require some time to get proficient, so:
上面的技术堆栈非常不同(PyQT,.NET WinForms,JVM Swing),需要一些时间才能熟练,所以:
Which alternative would you recommend and why? 您会推荐哪种替代方案?为什么?
I'm a Python guy and use PyQt myself, and I can wholly recommend it. 我是一个Python人,自己使用PyQt,我可以完全推荐它。 Concerning your cons:
关于你的缺点:
compilation, distribution and deployment more difficult?
编译,分发和部署比较困难?
No, not really. 不,不是真的。 For many projects, a full
setup.py
for eg cx_Freeze can be less than 30 lines that rarely need to change (most import
dependencies are detected automatically, only need to specify the few modules that are not recognized), and then python setup.py
will build a standalone executable. 对于许多项目,例如cx_Freeze的完整
setup.py
可能少于30行,很少需要更改(大多数import
依赖项是自动检测的,只需要指定几个无法识别的模块),然后是python setup.py
将构建一个独立的可执行文件。 Then you can distribute it just like eg a C++ .exe. 然后你可以像C ++ .exe一样分发它。
no QT experience
没有QT经验
I didn't have notable GUI experience either when I started out with Qt (only a bit of fiddling with Tkinter), but I grew to love Qt. 当我开始使用Qt(只有一点摆弄Tkinter)时,我没有显着的GUI体验,但我渐渐喜欢Qt。 Most of the time, all widgets work seamlessly and do what they're supposed to do - and there's a lot of them for many purposes.
大多数时候,所有小部件都可以无缝地工作并完成它们应该做的事情 - 并且它们有很多用于许多目的。 You name it, there's probably a widget that does it, and doesn't annoy the user by being half-assed.
你可以命名,可能有一个小部件可以做到这一点,并且不会因为半成品而烦扰用户。 All the nice things we've been spoiled with are there.
我们被宠坏的所有好东西都在那里。
Qt is huge, but the PyQt documentation answer most question with reasonable search effort. Qt 是巨大的,但PyQt文档通过合理的搜索工作回答了大多数问题。 And if all else fails and you know a bit of C++, you can also look at Qt resources.
如果所有其他方法都失败并且你知道一些C ++,你也可以查看Qt资源。
QT Designer not as nice as the Visual Studio Winforms designer
QT Designer不如Visual Studio Winforms设计器好
I don't know the VS Winforms designer, but I must admit that the Qt Designer is lacking. 我不知道VS Winforms设计师,但我必须承认Qt Designer缺乏。 I ended up making a sketch of the UI in the designer, generating the code, cleaning that up and taking care all remaining details by hand.
我最终在设计器中制作了UI的草图,生成代码,清理它并手动处理所有剩余的细节。 It works out okay so far, but my projects are rather small.
到目前为止一切正常,但我的项目相当小。
PS: PS:
(now that QT is LGPLed)
(现在QT是LGPL)
PyQt is still GPL only. PyQt仍然只是GPL。 PySide is LGPL, yes, but it's not that mature, if that's a concern.
PySide是LGPL,是的,但如果这是一个问题,它就不那么成熟了。 The project website states that "starting development on PySide should be pretty safe now" though.
该项目网站指出,“现在开始开发PySide应该非常安全”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.