Hi All,
i have basic python knowledge please let me know how to get started with jython please let me know where can i find good online books for jython, how to write some small programs and how to run them

Jython has potential, but there are precious few example codes out there. Well, see:

A lot of my Python26 code runs on Jython just fine. Not the Tkinter code, since Jython uses the Java GUI toolkit instead.

Here is an example

""" jy_input_output1.py

a Jython example for getting input and output on a console
using the swing.JOptionPane for input and message

tested with jython2.5.2  by  vegaseat

import java.util.Random
import javax.swing.JOptionPane as jop

print('Die Roller')
print('- - - - - -\n')
    s = 'How many sides should the die have?'
    sides = int(jop.showInputDialog(None, s))
    s = 'How many times should we roll the die?'
    rolls = int(jop.showInputDialog(None, s))
    rand = java.util.Random()
    for current in range(rolls):
        print('Roll %d --> %d' % ((current+1), rand.nextInt(sides)+1))
   jop.showMessageDialog(None, 'Integer Entry Error!')

I have my Editra IDE configured to run Jython code. Another general IDE that works well is ConText.

The Netbeans IDE might work, but I haven't figured it out yet. If anyone does, let me know right here!

Edited 5 Years Ago by vegaseat: code

This article has been dead for over six months. Start a new discussion instead.