# File: MovingCircle.py
# Date: October 9, 2006
# Created by: Deepak Kumar
# Purpose: A program that illustrates how to do simple animation of a
#           graphics object. We will draw a circle and make it move randomly
#           right-left and up-down. Try changing the move value to 2, 0 or other
#           x and y values...

from graphics import *
from random import *
from time import *

def main():
    # first create and draw the graphics window
    w = GraphWin("Circle", 500, 500)
    w.setBackground("white")


    # create a circle at a random location
    c = Circle(Point(250,250), 50)
    
    # set it to a color
    c.setFill("red")
       
    # draw it
    c.draw(w)

    # animate the circle
    for i in range(200):
        c.move(randrange(-4, 5), randrange(-4, 5))
        sleep(0.1)
        
    # end of program
main()
