# File: Xiang/move1.py # # Red Ball moves on the screen from graphics import * MAXX, MAXY = 500,500 # window size def initGraphics(): win = GraphWin( "Moving Red Ball R=25" , MAXX, MAXY ) return win def main(): win = initGraphics() deltaX,deltaY = 2,2 #step for move R = 25 # Radius ball = Circle( Point(100,100), R ) ball.setFill( "red" ) ball.draw( win ) for i in range (10): ball.undraw() ball.move(deltaX,deltaY) # ball moves with step (deltaX,deltaY) print "center x=",ball.getCenter().getX(), "center y=",ball.getCenter().getY() ball.draw(win) win.getMouse() win.close() main()