[Tutor] [Q] Python, Jython, and drawing application

dman dsh8290@rit.edu
Mon, 29 Oct 2001 22:04:35 -0500


On Mon, Oct 29, 2001 at 07:47:35PM -0600, Young-Jin Lee wrote:
| Hi, I'm new to Python programming and I have a question.
| If I make a Jython application, can the Jython application use the
| Java application?

Yes.

| I have a Java application and I want to switch my programming
| language to Python, but I don't want to dump my Java application. If
| it's possible, how can I do it? Any good tutorials? How about
| performance?

Simply run your code with Jython.  Here's an example :

------ jy.py ----
import javax

frame = javax.swing.JFrame()
frame.getContentPane().add( javax.swing.JLabel( "hello" ) )
frame.setSize( 100 , 100 )
frame.setVisible( 1 )

---------------


$ jython jy.py


| I have read the Python tutorial and I felt like Python is most
| focusing a server programming. (Relatively little documentation and
| tutorial on GUI exists.) 

There are many different GUI toolkits available for use in a python
application.  The tutorial doesn't talk about it because the tutorial
focuses on the python language, and not any libraries for it.  The
details of using a particular toolkit are found in the documentation
for that toolkit. 

If you are writing a pure python application, and using the C
interpreter, you can use
    GTK+/GNOME
    Qt/KDE
    wxPython
    Tkinter
    MSW (on Windows only)
    Fox
    PMW
    V
    (others?)

If you use jython, you are limited to the toolkits supported by java.
This includes
    AWT
    Swing

    GTK+/GNOME (uses JNI)
    Tkinter (Finn created bindings, but I don't know if they are curren)
    MSW (iff you use MS's JVM and COM)

| How difficult would it be to develop a
| petri net drawing

I don't know what that is.

| or a UML drawing application? 

I think it would be easier than with Java.  However, such apps already
exist (xfig, dia) so it may suffice for you to use one of these.  If
your goal is to practice programming, then go ahead and create another
one.

HTH,
-D