Hello, I am vegaseat, the goofy moderator from the Python forum of DaniWeb. I wanted to know if anyone in the Java forum has played around with Java based Python, also known as Jython.
Jython uses easy to learn Python syntax and can use the Java libraries. To make a short story long, here is an example ...
""" jy_List_99BoB2.py create the full lyrics of the '99 bottle of beer' song and show in a Jython (Java based Python) scrollable list box Download file jython_installer-2.5.2.jar from http://www.jython.org/downloads.html On Windows just double click the .jar file and Java will install the Jython program into a directory called jython2.5.2 to this .py file on Windows use: Jython.bat jy_List_99BoB2.py tested with jython2.5.2 by vegaseat """ # import needed Java libraries # swing is the Java GUI toolkit from javax.swing import * from java.awt import Color # creates all lines of '99 bottles of beer' lyrics # using some sensible slicing list_99bob =  bottle = " %s bottle" beer = "s of beer on the wall!" take = "! Take one down, pass it around," for k in range(99, 0, -1): s1 = ((bottle % k + beer[k==1:])*2)[:-13] s2 = bottle % (k-1 or "No") s3 = beer[k==2:-1] + "!" #print(s1 + take + s2 + s3 # test) list_99bob.append(s1 + take + s2 + s3) frame = JFrame('99 Bottles of Beer song') # allows frame corner x to exit properly frame.defaultCloseOperation = JFrame.EXIT_ON_CLOSE frame.setLocation(100, 150) frame.size = (400, 300) # create a list box and load it with the lyrics swing_list = JList(list_99bob) # give it a little color swing_list.background = Color.yellow # make it scrollable swing_list_scroll = JScrollPane(swing_list) frame.add(swing_list_scroll) frame.visible = True
If you have any Jython code samples, you are invited to the Python forum for an informal posting.
Oh, I almost forgot, Python and therefore Jython are OOP languages and you can write your code in OOP style of course. For simple stuff I usually don't.
Edited 5 Years Ago by vegaseat: OOP