This 'sticky' thread is for working examples of Python GUI code. Note that most wxPython examples have their own thread. Please use comments in your code to help the reader. The example code should be usable as a template, so folks get a feel for the toolkit and can use those examples/templates as a basis for more complex programs. We also welcome code that compares the various GUI toolkits. Again, don't clutter up the sticky with questions. Ask question in the regular forum. A brief history of GUI based Operating Systems migh be in order: The first Graphical User Interface …

Member Avatar
Member Avatar
+9 forum 235

Hi, I am given this assignment that should be run in Jython. The assignment says that the program consists of a Java application with a canvas and a textarea for turtle code. I need to create a Jython application that takes turtle code from the Java application, parses it with regular expressions and calls setPixel(x,y) in the Java application to draw a rectangle. the Java program ,setPixel(x, y) is used to control the painting and getCode() to get the code entered in to the turtle code textarea. These methods are both defined in the DYPL Java class. import Translater class …

Member Avatar
Member Avatar
+0 forum 8

Just a simple Jython code to test drawing on the canvas.

Member Avatar
+3 forum 0

Jython is a version of Python that can use the extensive Java library. Jython uses Python syntax and avoids the rather ugly syntax (at least for Pythonions) of Java. Here we apply it to bring up an image from a file.

Member Avatar
+4 forum 0

Hey all I need some help with Jython. In Python I'm given the easy option to read a file with [CODE]file = open('/dev/input/js0')[/CODE] Then I can put it into a non blocking mode with something similar to [CODE] import os, fcntl file = os.open('/dev/input/js0', os.O_NONBLOCK) [/CODE] But in Jython I'm not sure how to do this. I'm trying to read in from a joystick which only updates when a button is pressed down and then again when it is let up. Any help would be greatly appreciated. Thanks!

Member Avatar
+0 forum 0

In an earlier post, Tech-B stated that, other then dialogs, there wasn't 'any "real" GUI support' in Python that uses the Android SDK or SL4A/SAE. Has anyone tried Jython with the Android SDK?

Member Avatar
Member Avatar
+0 forum 3

Can I ask for a little help with virtualenv. I am looking at the docs here [URL="http://guide.python-distribute.org/pip.html"]http://guide.python-distribute.org/pip.html[/URL] and here [URL="http://www.jython.org/jythonbook/en/1.0/appendixA.html#virtualenv"]http://www.jython.org/jythonbook/en/1.0/appendixA.html#virtualenv[/URL] There are a few things I can't quite understand about it. First just to clarify I am on ubuntu and my default python is 2.7.1 1. I use virtualenv to create 'sandboxed' python environments but do I use virtualenv to manage(install and remove) python versions etc python3, pypy, jython or am I installing them separately and just using virtualenv to manage the 'sandboxing'? (guess is it like perlbrew or rvm). 2. How do I specify the interpreter type for the …

Member Avatar
Member Avatar
+0 forum 2

I took an intro python class and learned some about jython. Unfortunately, what I have in mind is far too complicated for my level of training. Is it possible to use jython to import pictures from a scanner? If so, what module would I start with/use? The scanner is an old Onetouch 9320 USB. I would totally use it with my PC, but that's really inconvenient since I do all my editing with my mac. Trem

Member Avatar
Member Avatar
+0 forum 1

So, I am working with some code I don't understand. Here is the file: [CODE=Python] import sys import os def change_ext(directory, old_ext, new_ext): for f in os.listdir(sys.argv[1]): base, ext = os.path.splitext(f) if ext[1:] == sys.argv[2]: os.rename(f, "%s.%s" % (base, sys.argv[3])) if __name__ == '__main__': if len(sys.argv) < 4: print "usage: %s directory old_ext new_ext" % sys.argv[0] sys.exit(1) change_ext(sys.argv[1], sys.argv[2], sys.argv[3]) [/CODE] When I run it through Jython in Command Prompt as follows: [CODE=Python] import chext chext.change_ext(".", "foo", "java") [/CODE] It gives me the error: [CODE]for f in os.listdir(sys.argv[1]): Index Error: index out of range: 1[/CODE] How do I fix this? …

Member Avatar
Member Avatar
+0 forum 4

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 ... [code=python]""" 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 …

Member Avatar
Member Avatar
+2 forum 8

Here is experiment of how VM and Swing UI manage the sort test posted previously, instead of CPython and Tkinter. The timing is not so sweet, but at least no Java required! [CODE]K:\jython2.5.2>java -jar jython.jar swing_test.py 256000 words generated in 10.93 s Sorted in 1.68 s List prepared in 22.71 s[/CODE]

Member Avatar
Member Avatar
+0 forum 4

The End.