This assignment will have you use JES - Jython Environment for Students.
In the ACCC Labs that have JES, it can be found by:
Write a python program in JES that will:
If you look at the python examples page for the examples from Lecture on 1/30/2007, you will see code that almost does what you need to do. Your code should be patterned after the code in the function pickAndShow (). While the function doesn't do exactly what the lab requires, you can modify the function to correctly satisfy the requirements of the lab.
The biggest thing not done in the example code is the simple modification of the image. JES comes with a number of functions that can be used for this. Some of these functions are:
addText () |
addText(picture, xpos, ypos, text) picture: the picture you want to add the text to xpos: the x-coordinate where you want to start writing the text ypos: the y-coordinate where you want to start writing the text text: s string containing the text you want written Takes a picture, an x position and a y position (two numbers), and some text as a string, which will get drawn into the picture. |
You may need to guess at the X and Y position used until you come up with something that works. Since the text is written in black, selecting a dark space on the image can be a problem. Note the the X position is in the horizontal (left to right) direction, while the Y position is in the vertical (top to bottom) direction.
The following shows and example of this.
Original Image: | |
Modified Image: |
When saving your image, use writePictureTo(). If you hardcode the filename in your program, remember two points.
You are submit your program electronically by placing it in the digital drop box in blackboard. Programs that are correct and submitted by the end of the student's lab time on the Wednesday the lab assignment is discussed will receive an extra 10% on the score of the lab. When saving your program, use a meaningful name like lab3.py.