Python GUI with Swing 
Author Message
 Python GUI with Swing

Hi All,

Is there any good solution for using Java Swing in python ?? I 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.

PyJava, JPE and JPI only for AWT package, no Swing.

--
Best Regards,

Winson Chang

3F, 2, 150 Lane, Sec. 5, Hsin I Rd., Taipei, Taiwan, R.O.C.

Tel: +886-2-27225333 ext 376
Fax: +886-2-27222330




Mon, 15 Sep 2003 13:36:50 GMT  
 Python GUI with Swing
|
|    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



Tue, 16 Sep 2003 02:07:07 GMT  
 Python GUI with Swing

Quote:
> 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.

Yeah tell me about it...lightweight components are the wrong way to go....
Awt would be a step faster, but that's still using Java of course


Tue, 16 Sep 2003 07:00:25 GMT  
 Python GUI with Swing
Let me explain more about it. I mean my customer need Swing, but I need
Python to build a pilot system. Swing maybe slow but my customer can accept.
If I use Swing thru Jython, it will be slower then directly using Java to
develop the system. So I need a solution to use Swing in Python, that's all.

Is there a module for Python called PySwing, only use Swing's look and feel
GUI ?? It maybe a big issue to rewrite Java's Swing library into C source
and transfer into Python' s module.

Thanks all guys here.

--
Best Regards,

Winson Chang

3F, 2, 150 Lane, Sec. 5, Hsin I Rd., Taipei, Taiwan, R.O.C.

Tel: +886-2-27225333 ext 376
Fax: +886-2-27222330


Quote:
----- Original Message -----

Newsgroups: comp.lang.python

Sent: Friday, March 30, 2001 7:00 AM
Subject: Re: Python GUI with Swing

> > 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.

> Yeah tell me about it...lightweight components are the wrong way to go....
> Awt would be a step faster, but that's still using Java of course

> --
> http://mail.python.org/mailman/listinfo/python-list



Tue, 16 Sep 2003 15:21:45 GMT  
 Python GUI with Swing

Quote:

> [snip] Swing maybe slow but my customer can accept.
> If I use Swing thru Jython, it will be slower then directly using Java to
> develop the system. So I need a solution to use Swing in Python, that's all.

So you want to use C Python because it's faster than Jython, but you want
the Swing GUI? I think you're making things difficult for yourself.

If Swing is fast enough for your customers, no Java code could be too
slow for them.  :-)

Therefore, why not write the application in Jython, and re-write
speed-critical parts in Java? For most parts of your application, Jython won't
be any slower than Java.

(Personally, I would just write everything in Jython and add 100MHz to the
minimum recommended system requirements to make up for the difference between
Jython and straight Java.)

-Steve

--
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo



Tue, 16 Sep 2003 16:03:19 GMT  
 Python GUI with Swing
| Let me explain more about it. I mean my customer need Swing, but I need
                                                   ^^^^

How much is it really a _need_ vs. a _want_ or _like_?  Perhaps you
can convince them that a different toolkit would better suit their
needs?

| Is there a module for Python called PySwing, only use Swing's look and feel
| GUI ??

Swing's L&F ..., hmm ..., which one?  I personally like "Metal" but it
also has "Windows" and "Motif".  Supposedly Tk looks like Windows on
Windows and Motif on *nix.  wxWindows (wxPython) can look like Windows on
Windows, GTK or Motif on *nix and Mac (not sure if it is Classic or
the new OSX look) on MacOS (but AFAIK the Mac port isn't as
complete/stable).

| It maybe a big issue to rewrite Java's Swing library into C source
| and transfer into Python' s module.

I'm sure it would be.  Swing is quite large.  Perhaps someone with a
lot of interest could rewrite it in Python and devise some sort of
'Frame' replacement (since it needs to access the native windowing
system at some point).  It would be interesting, if not really nice,
to have a toolkit written (almost) entirely in Python.  The advantage
would be to not depend on any other "native" libraries, just a python
interpreter.

| Python to build a pilot system. Swing maybe slow but my customer can accept.
| If I use Swing thru Jython, it will be slower then directly using Java to
| develop the system. So I need a solution to use Swing in Python, that's all.

I kind of like Steve Purcell's suggestion of increasing minimum CPU
requirement to offset the overhead and appear just as fast.

Also, Java is faster than Jython (by definition pretty much) so
writing stuff that needs to be just a bit faster in Java is a pretty
good idea too.  (BTW, if you haven't tried Jython yet, you will be
quite amazed at its seamless integration with Java classes)

| Thanks all guys here.

No problem.  Glad to help.

-D



Wed, 17 Sep 2003 00:21:56 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How does Tk compare to Swing for GUI for Python

2. Starting a python GUI from another python GUI.

3. Starting a python GUI from another python GUI.

4. Java Swing bindings for python?

5. ** APS (GUI) opportunity ** APS (GUI) ** APS (GUI) Experience required

6. Sun vs. IBM and the origins of Swing

7. Rumors about Swing

8. Browse swing (CW2.003)

9. Visual Netrexx, Swing 1.0.2, and OS/2 JDK level

10. Official web-site for the book Swing (free)

11. Historical Swings in Dynamic Type Costs

12. Java Swing and VRML!

 

 
Powered by phpBB® Forum Software