Scott Sanders (dotnot) asks: Is anyone working on a port of SWT to Python? Is anyone interested in such a thing?
Of course this is something that is possible today using Jython. I have configured the RedRobin Jython Eclipse plugin to allow me to easily script SWT (and JFace from Jython ... works like a charm.) Here is a quick Jython Hello World for SWT. from org.eclipse.jface.window import *
from org.eclipse.swt import *
from org.eclipse.swt.widgets import *
import sys
class Hello(ApplicationWindow):
def createContents(self, parent):
b = Button(parent, SWT.PUSH, widgetSelected=self.helloWorld)
b.text = "Hello World"
return b def helloWorld(self, evt):
print "Hello There ..."
sys.exit(0)
w = Hello(None)
w.blockOnOpen = 1
w.open()
Display.getCurrent().dispose()
In order to get this to work in eclipse using the Jython plugin, you need to either create a jython project in eclipse or add the Jython nature to an existing project, add the swt and jface jars into the class path in the project's jython properties and finally set the java.library.path to the location of the swt library also in the project's jython properties. This last step is so that swt can find its os native libraries.
|