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

Recommended Answers

All 2 Replies

Jython has potential, but there are precious few example codes out there. Well, see:
http://www.daniweb.com/software-development/python/threads/191210/1565073#post1565073

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')
try:
    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))
except:
   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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.