views:

99

answers:

3

Python has many GUI toolkits. If I understand correctly, these toolkits typically take on the responsibility of rendering their own widgets (rather than relying on the operating system). This achieves cross-platform support at the cost of having widgets that don't necessarily look, feel and behave exactly like their native counterparts. Does Python have a GUI toolkit that is cross-platform and takes advantage of each system's native widgets?

According to GUI Programming in Python, there are at least two candidates:

Lucid

Unfortunately, this library seems to have disappeared. It's link now redirects to Icy Labs, a company that "designs and distributes components and devices for electronics and robotics development" (???).

PySWT

This is a port of the SWT library for Java (which I am already familiar with). This library doesn't feel like Python (for example, it retains the set* and get* methods that are common in Java). Therefore, I am curious to know if there is a more authoritative library that meets my needs.

+4  A: 

Is wxWidgets an option? As far as I know, it integrates with whatever the OS has to offer - win32 on windows, gtk on Linux and, I think, Aqua on OSX.

Ivo van der Wijk
This library looks very promising! [One of the first example programs](http://wiki.wxpython.org/Getting%20Started#Adding_a_menu_bar) even overcomes [a known shortcoming I have with SWT](http://stackoverflow.com/q/2117057/41619)!
Adam Paynter
@Adam wx is pretty good, but there are still compatibility issues around. As long as there are tests for this, there shouldn't be problems though.
Dana the Sane
@Dana the Sane: Where can I learn about these compatibility issues?
Adam Paynter
@Adam I'm not aware of a catalogue of issues, I'm only speaking about those that I encountered.
Dana the Sane
+2  A: 

What about Qt?

And it's attendant wrapper, PyQt? http://en.wikipedia.org/wiki/PyQt

Qt for the most part looks native. I don't think you'll ever find a cross-platform toolkit that is uses native widgets exclusively and still be cross-platform. Those goals are to some extent mutually exclusive.

Gilead
Qt has a [widget gallery](http://doc.trolltech.com/4.6/gallery.html) so the asker can decide for himself if Qt looks native enough, which I think it does. Also, I'll note that the KDE4 style isn't on there.
jonescb
Thanks for the recommendation. I already knew about Qt, but I was looking for something even closer to the native look-and-feel (Qt applications have typically felt "different" to me). I agree that the goals seem somewhat mutually exclusive, so I should clarify what I meant. I was thinking from the mindset of SWT which attempts to render everything natively, unless the platform does not have such a widget. In that case, SWT resorts back to rendering the widget itself on that platform.
Adam Paynter
I just noticed on Wikipedia that (recent versions of Qt use the native APIs of the different platforms to draw the Qt controls, and so do not suffer from such issues)[http://en.wikipedia.org/wiki/Qt_(framework)#Use_of_native_UI-rendering_APIs]. Therefore, I was mistaken about it. I will have to give it another look.
Adam Paynter
A: 

pyside LGPL bindings for qt. Note there is also PyQt which is GPL or paid for closed source use.

stonemetal
Thanks for the recommendation! However, I would prefer something truly native (although Qt makes a valiant attempt at emulating it). :)
Adam Paynter
according to wikipedia: Qt used to emulate the native look of its intended platforms, which occasionally led to slight discrepancies where that emulation was imperfect. Recent versions of Qt use the native APIs of the different platforms to draw the Qt controls, and so do not suffer from such issues.
stonemetal
@stonemetal: Thanks for that comment! I also noticed that comment. I will have to give Qt another look.
Adam Paynter