# Bouncing Ball # example released to the public domain - Jay Summet # Spring 2010 from myro import * win = GraphWin("Pong", 500,500) xPos = 100 yPos = 150 xDelta = 6 yDelta = 3 p = Point(xPos,yPos) ball = Circle(p, 10) ball.setFill( color_rgb(255,0,0) ) ball.draw(win) while timeRemaining(20): #Check to make sure we are not going off #the screen! If we do, reverse direction! if (0 > xPos) or (500 < xPos): xDelta = -xDelta if (0 > yPos) or (500 < yPos): yDelta = -yDelta #Move the ball: ball.move(xDelta, yDelta) xPos = xPos + xDelta yPos = yPos + yDelta wait(0.02) #End of program