Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python GUI compared to Swing?

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.

like image 209
mike rodent Avatar asked Oct 17 '11 19:10

mike rodent


People also ask

Is swing good for GUI?

Yes. Swing is high-performance, robust, works well on all platforms, and is extremely well supported by GUI designers.

Is Python GUI good?

The Python GUI Project, aka PyGUI framework, is a simple API for developers to create user interfaces using native elements for Python applications. As a lightweight API, not a lot of code is needed between the app and the target platform, making it far more efficient than many of the other frameworks on this list.

Does Python have swing?

One of the major features of Jython is its ability to use the Swing GUI library in JDK. The Standard Python distribution (often called as CPython) has the Tkinter GUI library shipped with it.

Which is best GUI for Python or Java?

I think Python has many toolkit for GUI. Java has Swing. If you want to develop cross-platform friendly GUI,I suggest wxPython.


1 Answers

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.

like image 133
Petr Viktorin Avatar answered Nov 02 '22 14:11

Petr Viktorin