Python GUI with Swing

D-Man dsh8290 at rit.edu
Thu Mar 29 13:07:07 EST 2001


On Thu, Mar 29, 2001 at 01:36:50PM +0800, ±i¸Î¯q wrote:
| 
|    Is there any good solution for using Java Swing in Python ?? I

Jython would be it.  It is as simple as

import javax.swing
f = javax.swing.JFrame()
f.getContentPane().add( javax.swing.JLabel( "Hello World" ) )
f.setVisible( 1 )


|    surveyed Jython, PyJava, JPE and JPI. Jython sounds great but I only
|    needs Swing as my GUI and the whole Jython is based on Java, speed
|    will be a issue. Actually, I would like to find out a module can
|    access Java's Swing package.

If speed is an issue, don't use Swing.  Swing is quite slow (from
experience) as it is implemented entirely in Java.  If you only need
to support a single platform you can use Jython+Swing+JNI+C using JNI
to connect Java to the speed critical stuff written in C.  Otherwise I
would recommend looking at other toolkits such as PyGTK and wxPython.

-D





More information about the Python-list mailing list