""" ChapterAnimation/bounce.py bounce: move a circle left - right """ from graphics import * winW,winH = 400,500 # window Width x Height def main(): win = GraphWin( "Demo: rolling car", winW, winH ) radius = 25 myc = Circle( Point(10,70), radius) myc.setFill( '#ffff00' ) myc.draw( win ) speed = 1 while True: myc.move(speed * 0.1, 0 ) if myc.getCenter().getX() > winW-radius or myc.getCenter().getX() < 0: speed = speed * -1 win.close() main()