Home > General Development > PySWT a Python Binding to SWT PySWT a Python Binding to SWT Submitted by Zilin Du 2005-06-30 General Development 28 Comments PySWT is a Python Binding to the IBM Eclipse SWT library, to provide Python with a cross platform native looking GUI. About The Author 28 Comments 2005-06-30 6:14 am Anonymous Nicely done, great looking gui’s in minimal code, does this depend on Java though? 2005-06-30 6:21 am Anonymous Atm, from looking at the site it uses Jython as its Python >>—> Java interface, but Zilin (the PySWT creator) is wanting to create a C++ Wrapper instead of relying on Jython. 2005-06-30 6:43 am Anonymous …Naive looking toolkit? There are a real lot of GUI bindings. DotGNU once had 2x more bindings than real apps. The question is what gets used. And to get used, you have to get your bindings bundled with linux distros. Other platforms generally NOT care about exotic things. 2005-06-30 6:55 am Anonymous SWT looks native like Jacko looks black. Sorry, but SWT has a long way to go yet… 2005-06-30 7:13 am Anonymous As far as I can tell, it is using GCJ with SIP (Python wrapper generator, originally developed for PyQt). So it does not require JRE. 2005-06-30 7:34 am Anonymous Although libgcj.dll is about 10mb – not so good if you want to distribute small gui apps. 2005-06-30 7:41 am Anonymous cross platform native looking GUI What, you mean like wxPython? Sorry, I’ve already got my Python GUI toolkit, and it looks native on every important platform: Windows, X11, Motif, Qt, Gtk, Mac Classic, and Mac Cocoa. 2005-06-30 7:44 am Anonymous > Although libgcj.dll is about 10mb For comparison, on my computer (Debian Sid), size of Qt library (/usr/lib/libqt-mt.so.3.3.4) is 7.0 MB, and libgcj (/usr/lib/libgcj.so.4.0.0) is 7.7 MB. So they are comparable. If distributing an app using Qt is feasible, so is one using GCJ. 2005-06-30 7:59 am Anonymous I don’t understand SWT (on Python anyhow) or WX – why not just use GTK straight-up instead of going through those goofy intermediary APIs? The WIMP theme that’s built into GTK 2.6 makes GTK look almost exactly like native Windows widgets. Plus, when using GTK natively, you get the backing of Glade to design your GUIs with. 2005-06-30 8:09 am Anonymous Well for a start GTK isn’t native on OSX. 2005-06-30 8:31 am Anonymous And wx looks weird (read: ugly) on linux/gtk, especially since the default is still gtk+1.2 with non antialiased fonts. Plus the widgets do not resize correctly, and the general layout of wx apps is consistently ugly 🙂 I know: I tried Boa with wx compiled for gtk2… ugly. Text spilled outside widgets… 2005-06-30 8:34 am Anonymous It’s an interesting achievement, but I’m not sure where it’s going. Arguably PyQt has the lead now that Qt is GPL everywhere, I suppose PySWT falls in free commerical use camp with wxPython. However Qt has the advantage of Qt Designer (which is not insignificant when it comes to drawing up GUIs). One thing that puzzles me though is the memory management. SWT famously requires memory management, even on Java, a managed language. I can’t tell from the samples if this is still the case with PySWT: all the sample GUIs are fairly static (i.e. they appear, do nothing, and get destroyed with the rest of the app when it dies). Does anyone know what the story is? 2005-06-30 9:21 am Anonymous >It’s an interesting achievement, but I’m not sure where it’s going. Arguably >PyQt has the lead now that Qt is GPL everywhere, I suppose PySWT falls in free >commerical use camp with wxPython. However Qt has the advantage of Qt >Designer (which is not insignificant when it comes to drawing up GUIs). Of course PyQt is not available for Qt 4 yet so it’s not in the lead quite yet. 2005-06-30 9:36 am Anonymous True, but it’s on the roadmap, and for what it’s worth, the PySWT bindings aren’t finished yet either: http://www.cs.nyu.edu/zilin/pyswt/pmwiki.php?n=PmSWT.TODO 2005-06-30 10:51 am Anonymous PyQt works now on Qt3 on Linux, and on Win32 with the GPL ported version of Qt3. — Simon 2005-06-30 11:59 am Anonymous > One thing that puzzles me though is the memory management. SWT famously requires memory management, even on Java, a managed language. I can’t tell from the samples if this is still the case with PySWT: all the sample GUIs are fairly static (i.e. they appear, do nothing, and get destroyed with the rest of the app when it dies). Does anyone know what the story is? You’re confused. Java provides memory management – not resource management. They are different. SWT doesn’t need you to manage memory either, just some external, native, unmanaged resources that are allocated by the native operating system (colors, fonts, etc). Is this any different than having to remember to close a stream or database connection? It may seem silly at first (especially because Swing gets around it by emulating everything and not having to communicate with the native windowing system), but it makes sense – and the way they’ve implemented SWT makes it really a non issue anyway because the rules are so easy to follow. 2005-06-30 12:01 pm Anonymous since when has swt been more native looking than wxwidgets or qt? 2005-06-30 12:42 pm Anonymous Well for a start GTK isn’t native on OSX. Yup – and that should be fixed. 2005-06-30 1:13 pm Anonymous “since when has swt been more native looking than wxwidgets or qt?” Since forever for anyone using Gnome 2 or XFce4 as their primary desktop. 2005-06-30 2:21 pm Anonymous Yes it should but no one seems to be interested enough to take it though to completion. 2005-06-30 2:57 pm Anonymous Just use Jython and Java to create your SWT app, instead of creating a whole other customized wrapper on top of SWT. Then if you wanted to also you can use IKVM to generate an .exe that runs in .NET or Mono: http://www.ikvm.net/ 2005-06-30 3:26 pm Anonymous On my Linux machine Qt is the native look, so saying it has a “cross platform native looking GUI” without naming the toolkit is at least questionable. 2005-06-30 4:14 pm Anonymous SWT takes on the native look of what ever OS you’re using, if you’re using QT it looks like QT, if you’re using GTK+ it looks like GTK+, if you’re using Win32, it looks like Win32, etc. 2005-06-30 5:27 pm Anonymous Where did the moderated comments go? I had something to say about the screenshots (nothing wrong with that, right? We’re talking about UI’s here), but it’s gone. I assume it has been moderated, as some people can’t take the truth. 2005-06-30 6:42 pm Anonymous WxWidgets-2.6.0 has been released a few weeks ago. Gtk2 is now default, the resize problems seem to be gone. The wx app I’m mainly using (poEdit) even uses Gtk stock icons, with no change to the application, simply by recompiling. I’ve seen apps where the ugly win-classic icons are still there though. This app at least is now practically indistuingishable from a native Gnome app, except for the about box and the help browser; the wx help browser is so much better than yelp – yelp is horrible. So as a user I’m very satisfied, VLC is looking good too. As a developer I still have my reservations. 2005-07-01 8:02 am Anonymous They really should be called QtPy and SwtPy (cutie-pie and sweety-pie) 2005-07-01 8:42 am Anonymous Just for those pointing to the size of libgcj: That is fixable. SWT does not put very heavy requirements on the java class library, so you can probably strip out a *considerable* part of those 10 Mb for the purpose of creating a lightweight libgcj.so (or .dll). 2005-07-01 12:35 pm Anonymous why not prove glade?