JES is a development environment for Python. To run it from Linux, select USF CS | JES. From Windows, select Start | All Programs | JES.
Loading JES might take a few seconds. After it comes up, Click on
Help | Table of Contents.
This will get you to some information and tutorials on how to create images, sound, and movies with JES. For now, just follow the instructions below.
JES has two main windows. The top one is a text editor in which you can create .py python programs. The bottom one is a python interactive interpreter. After creating or opening a python file, you can click 'Load' and it will automatically be loaded into the interpreter.
JES provides some library methods of its own that are not part of python. One is pickAFile() which pops up a file choosing dialog. In the interactive interpreter, enter the following:
>>> fileName= pickAFile()
When the file chooser appears, choose some file.
>>> print fileName
This should print out the full path of whatever file you chose.
Now let's view a picture.
1. Open a web browser and find an image. Right-click the image and save it to your home directory.
2. Call pickAFile and this time pick the image file you just downloaded.
>>> filename= pickAFile()
3. Create a picture object with the 'makePicture' function provided by JES
>>> pic = makePicture(filename)
4. Show it:
>>> show(pic)
The image should appear.
5. Now let's manipulate the picture. There's a list of functions that can be executed on pictures. To see what exists, select Help ! Understanding Pictures | Picture Functions in JES.
For now, let's just draw a line on our picture. Try the following:
>>> addLine(pic,0,0,500,500)
>>> repaint(pic)
Do you see the line on the picture?
6. Draw some text on the picture:
>>> addText(pic,100,100,'HELLO')
7. Note that the manipulations take place on an in-memory (RAM) version of the picture. If you want to modify the actual picture file you loaded, you must call
>>> writePictureTo(pic,filename)
After doing this, go into the folder where the pic is and double-click it. Whatever application opens it should show it with the line.
Next week, we'll learn how to manipulate images pixel by pixel.