python GUI 与 Swing 相比?
我想说“与 Swing 相比最好的 python GUI”...但被严厉地告知我的问题“太主观”。我向机器中的确定性幽灵道歉。
我目前正在使用 Jython...在使用 Java 多年之后,现在已经使用它大约 6 个月了。我喜欢 Jython 调用所有 Java 类的能力,并且还可以轻松地从 Java 处理方式过渡到 Python 方式。
但仔细想想,我意识到到目前为止我使用的最常见的 Java 包是 Swing 包。我花了很多年时间与 Swing 搏斗,最终认为我已经将这头野兽锁在了某种身体锁之下。顺便说一句,我也认为 Swing 很棒,而且我不得不说,例如,我是一个键盘狂热分子,所以不想切换到 GUI,因为在 GUI 中你没有类似于潜伏在其中的功能。 ActionMap-InputMap,可能没有多少人那么关心。如果我放弃 JTree 和 JTable,那真的是一种耻辱,因为我已经花了这么多时间去研究它们。说真的,它们非常强大……
但与此同时,我很快就迷上了 Python 的做事方式。我可以并且打算坚持使用 Jython。但我只是想知道各种 CPython GUI 是什么样的......特别是它们的功能和多功能性与 Swing 相比如何?
额外: 我被要求提供一些细节:好的,如果您愿意,可以使用键盘控制节点的导航和折叠/展开...滚动窗格上的树 GUI 对象怎么样?自动发生(如果您愿意的话),并且您可以控制外观和感觉等。或者您可以全面控制表格的大小调整,以及当单个单元格获得/失去焦点时会发生什么。您可以在其中子类化渲染器和编辑器。正如我在评论中所说,一个热衷于 Swing 且是 Swing 的大用户但仍然过渡到 CPython GUI 并感到高兴/不高兴的人......可能是回答这个问题的理想人选。
I wanted to say "best python GUI compared to Swing"... but was sternly told my question was "too subjective". I apologise to the deterministic ghost in the machine.
I'm currently using Jython... have been using it for maybe 6 months now following years of Java. I love Jython's ability to call on all the Java classes, and also to ease the transition from a Java way of doing things to a Python way.
But thinking about it I realise that by far the most common Java packages I'm using are the Swing ones. I have spent many years wrestling with Swing and finally think I have the beast under some kind of body-lock. I also think Swing is wonderful, by the way, and I have to say that I am something of a keyboard fanatic, for example, so wouldn't want to switch to a GUI where you don't have power akin to that lurking in ActionMap-InputMap, which maybe not many people care that much about. It would also be a shame really to turn my back on JTree and JTable, having spent so much time tearing out what was left of my hair about them. Seriously, they are fiendishly powerful...
But at the same time I'm fast becoming hooked on the Python way of doing things. I can and intend to stick with Jython. But I was just wondering what the various CPython GUIs are like... and specifically how their power and versatility compare with Swing?
added:
I have been asked to provide some specifics: OK, what about a tree GUI object sitting on a scroll pane where it is possible, if you want to, to control navigation and collapsing/expanding of nodes using the keyboard... where the scrolling happens automatically (if you want it to) and where you have control over look and feel, etc. Or tables where you have comprehensive control over resizing, over what happens when individual cells gain/lost focus. Where you can subclass renderers and editors. As I said in my comment, someone who is/was keen on, and a big user of, Swing but nonetheless made a transition to a CPython GUI and was happy/unhappy... might be the ideal person to answer this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从来没有对 Swing 做过太多事情,但是 Qt (及其 bython 绑定, PySide 或 PyQt4),据我所知,符合您的所有标准。
Qt 专注于按照底层操作系统的惯例行事。因此,最明显的事情通常是“正确”的事情,但如果你想要控制,你可以去覆盖外观或行为。
至于Python式的做事方式......绑定已经到了。老实说,他们仍然感觉有些 C++ 风格。
另请阅读一些 有关两者比较的其他问题。
I never done much with Swing, but Qt (and its bython bindings, PySide or PyQt4), matches all of your criteria as far as I can understand them.
Qt focuses on doing things as it's customary on the underlying OS. So the most obvious thing to do is usually the “right” thing to do, but if you want control you can go and override the look or behavior.
As for the pythonic way of doing things... The bindings are getting there. They still feel somewhat C++-ey, to be honest.
Also read some other questions on comparison between the two.
我认为Python有很多GUI工具包。
Java 有 Swing。如果你想发展
我建议跨平台友好的GUI
wxPython。
I think Python has many toolkit for GUI.
Java has Swing. If you want to develop
cross-platform friendly GUI,I suggest
wxPython.