Python is a great programming language with a set of great platform independent libraries. However, there is no standard GUI library for Python, although, a lot of python binding, like, pygtk, PyQT? are available.

SWT is a cross-platform GUI library from IBM's eclipse for Java. It wraps native platform dependent window widgets into jave classes using JNI. It has very good look and performance. If we can rewrite it using C++, it would be great.

I want to use SWT in python. Actually, thanks great Jython, I can do it already. But because of slowly development of Jython and not-very-good performance, I want to have a native python wrapper.

After PyLucene's successfully brings GCJ, SWIG into Python+Java, i tried to write SWIG interface files to wrapp SWT. I did some initial success, but gave up because of two reasons:

  1. very big python wrapper classes causing bad performance
  2. I need write additional java class manually in order to implement callback (event listeners in SWT)

Then, I turned to SIP when I began to do some PyQt? coding. I found it is a great tool but with very limited documentation. Thanks great open source, I tried to read its source codes. After several days working, I made some changes on SIP's code generator so that it can produce a python wrapper for GCJ'd java classes. Equipped this tool, I just wrote some sip files (write some python to generate from C++ header files for GCJH) and run. Finally, PySWT is out.

You can see a screenshot first, then you can see how easy it can be coded in python now from here now. If you want to try, follow these instruction to try your own.

I made all makefiles and generated C++ wrapper codes available here now. I'm extremely busy. I'm not sure I can update it very frequently, but I will work as much as I can. Hope you guys can enjoy it and let me know the feedbacks.

Download lastest pyswt-0.0.3.tgz (including jsip)

Zilin (zilin AT cs DOT nyu DOT edu) 2005-06-28

Valid XHTML 1.0! Valid CSS!