Unformatted text preview: COM110 Fall 2014
Warm-‐up exercise 6
Due Wed, Oct 1
Take the animated square program from class and add to it.
1. First test it to make sure it works. If you don’t have it, the code (uncommented) was something like this. (Yours should be commented to clearly explain what each line of code does.)
from graphics import *
from time import *
for i in range(310):
sleep(0.02) #pause .02 seconds between iterations sendoff = Text(Point(200,400),"Click anywhere to close.")
2. Add a second Text object (i.e., and instance of the Text class) that iniGally appears in the middle of the
square that reads: This is a red square.
Click to see it move.
Hint: remember the special character that can be used in any string: “\n”
3. Then add a second win.getMouse() call immediately before the animaGon loop, so that the program
pauses, waiGng for a user click, before entering the loop.
4. How would you make the text that you added in step 2 “stay on the square” as it moves? ...
View Full Document
- Fall '15