Wes Griffin & Sue Evans
Adapted from the CS1 Course at Swarthmore College by Lisa Meeden
Press space bar for next screen
from graphics import * win = GraphWin("Draw Circles", 400, 400) circ1 = Circle(Point(50, 50), 40) circ1.setFill('red') circ1.setOutline('black') circ1.draw(win) circ2 = Circle(Point(200, 200), 50) circ2.setFill('blue') circ2.setOutline('red') circ2.draw(win) line1 = Line(Point(350, 50), Point(350, 350)) line1.setWidth(4) line1.draw(win)
point = win.getMouse()
center1 = circ1.getCenter() dx = point.getX() - center1.getX() dy = point.getY() - center1.getY() circ1.move(dx, dy)
from time import sleep sleep(1.0)
create a new graphics window with an orange background draw a yellow circle somewhere in the window draw the string "Click mouse on new location for circle" near the bottom of the window wait for user input
for 3 clicks: get the location of the mouse click calculate how far to move the circle animate the circle's movement close the window