Start New Discussion within our Software Development Community

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.

view an image with Jython using the Java swing GUI toolkit
and other Java library items

get the free Jython installer

to run this code on Windows you can use

tested with jython2.7.2  by   vegaseat   07jan2013

from pawt import swing
from java import io
from javax import imageio

def view_image(image):
    # create a frame/window
    frame = swing.JFrame("Jython Image Viewer")
    # allows frame corner x to exit properly
    frame.defaultCloseOperation = swing.JFrame.EXIT_ON_CLOSE
    frame.visible = True
    # change to fit image size
    frame.setSize(1500, 1000)

# get an image file you have available ...
image_filename = "C:/Windows/Web/Wallpaper/Nature/img4.jpg"
# load the image from the file
image =
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.