#Bouncing Ball - Using Calico Graphics from Graphics import * from Myro import timer #used for the animation. WINSIZE = 500 win = Window("Pong", WINSIZE, WINSIZE) win.mode = "manual" #Trick to make the animation smoother.... ball = Circle((100,100), 10) #Start at X=100, Y=100, Radius 10, default color... ball.draw(win) #Draw it on the window #Delta X and Delta Y...how much the Ball will move each step. dx = 4 dy = 10 #Now, animate it for 15 seconds: for i in timer(15): ball.move(dx,dy) wait(0.1) #Wait for 1/10th of a second so the user can see the ball moving! win.update() #Because we set the window mode to manual, we must tell it when to update! if ball.getX() > WINSIZE or ball.getX() < 0: dx = -dx if ball.getY() > WINSIZE or ball.getY() < 0: dy = -dy