简体   繁体   English

用于跨平台应用程序的Python + QT,Windows Forms或Swing?

[英]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: 优点:

  • Python the language Python语言
  • open source is strong in the Python world (lots of libraries and users) 开源在Python世界中很强大(很多库和用户)
  • SQLAlchemy: A fantastic way to interact with a DB and incredibly well documented! SQLAlchemy:与数据库进行交互的绝佳方式,并且记录得非常好!

cons: 缺点:

  • compilation, distribution and deployment more difficult? 编译,分发和部署比较困难?
  • no QT experience 没有QT经验
  • QT Designer not as nice as the Visual Studio Winforms designer QT Designer不如Visual Studio Winforms设计器好

2) .NET/Mono, Windows Forms, C#, (Fluent) NHibernate, System.Data.SQLite 2).NET / Mono,Windows Forms,C#,(流畅)NHibernate,System.Data.SQLite

pros: 优点:

  • C# (I like it, especially compared to Java and would like to get more experience in it) C#(我喜欢它,特别是与Java相比,希望获得更多经验)
  • The Winforms GUI designer in Visual Studio seems really slick Visual Studio中的Winforms GUI设计器看起来非常流畅
  • IntelliSense 智能感知
  • ClickOnce Deployment(?) ClickOnce部署(?)
  • Windows Forms look and feel good on Windows Windows窗体在Windows上看起来很好看

cons: 缺点:

  • (Fluent) NHibernate far less documented than SQLAlchemy; (流畅)NHibernate远没有SQLAlchemy那么有记录; also annoying: Fluent docs refer to NHibernate docs which refer to Hibernate (aargh!). 同样烦人:流畅的文档引用了NHibernate文档,它引用了Hibernate(aargh!)。 But plain NHibernate + XML does not look very comfortable. 但简单的NHibernate + XML看起来不太舒服。
  • Windows Forms will not look + behave native on Linux/Mac OS (correct?) Windows Forms在Linux / Mac OS上看起来不像原生(正确吗?)
  • fewer open source libraries in the .NET world, fewer OSS users, less documentation in general .NET世界中的开源库越少,OSS用户越少,一般文档就越少
  • no WinForms and NHibernate experience 没有WinForms和NHibernate的经验

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: 优点:

  • JVM/Swing work well as cross-platform basis JVM / Swing可以作为跨平台的基础
  • Jython Jython的
  • SQLAlchemy SQLAlchemy的
  • lots of open source libraries 很多开源库

cons: 缺点:

  • Swing seems ugly and difficult to layout Swing看起来很难看并且难以布局
  • lacks a good GUI designer 缺乏一个优秀的GUI设计师
  • Guessing that I won't be able to avoid Java for UI stuff 猜测我无法避免Java用于UI的东西
  • Not sure how stable the Jython/Java integration is 不确定Jython / Java集成的稳定性

(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.

相关问题 跨平台应用程序中的BinaryFormatter - BinaryFormatter in cross-platform application 用于跨平台Xamarin Forms的UserControl - UserControl for cross-platform Xamarin Forms 跨平台应用Mono中的应用图标 - Application Icons in Mono for cross-platform application 使用复杂的GUI编写跨平台应用程序 - Writing cross-platform application with a complex GUI 使用 __ANDROID__ 在跨平台库中编写的代码不会在 Xamarin forms 应用程序中执行 - Code written in Cross-platform library with __ANDROID__ does not execute in Xamarin forms application 创建Xamarin.Forms跨平台应用程序时出现“此项目需要Visual Studio更新才能加载”错误 - “This project requires a Visual Studio update to load” error when creating a Xamarin.Forms Cross-Platform Application 创建Xamarin.Forms跨平台应用程序时,“此项目需要加载Visual Studio更新”错误 - “This project requires a Visual Studio update to load” error when creating a Xamarin.Forms Cross-Platform Application 适用于通用Windows平台的MonoGame跨平台条件编译符号 - MonoGame Cross-Platform Conditional Compilation Symbol for Universal Windows Platform Windows Shell扩展的跨平台替代方案-WebDAV平台? - Cross-platform alternative to a windows shell extension - WebDAV platform? 如何在Xamarin Forms跨平台中绑定图像集合 - How to bind collection of images in Xamarin Forms Cross-Platform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM