WEEK04: computer graphics, using objects
---------------------------------------------------------------
 F: getX() and getY(), color, using sleep for animations

LAB4: due next week
QUIZ 2 today!


COLOR...rgb = red green blue:

- try using the color_rgb function!
- each color component (r, g, b) can have a value from 0 to 255
  (0 means none/dark, 255 means full on/bright)

>>> from graphics import *
>>> w = GraphWin()
>>> p = Point(50,70)
>>> c = Circle(p,30)
>>> c.draw(w)
>>> color = color_rgb(0,0,0)       # black
>>> c.setFill(color)
>>> color = color_rgb(0,0,255)     # blue
>>> c.setFill(color)
>>> color = color_rgb(0,255,0)     # green
>>> c.setFill(color)
>>> color = color_rgb(0,255,145)   # greenish-blue
>>> c.setFill(color)



ANIMATION and SLEEP:

this simple animation doesn't look very good:

>>> from graphics import *
>>> w = GraphWin("hello",600,600)
>>> p = Point(100,300)
>>> c = Circle(p,50)
>>> c.draw(w)
>>> c.setFill("blue")
>>> for i in range(200):
...   c.move(1,0)

try adding the sleep command to slow down the animation:

>>> from time import sleep
>>> for i in range(200):
...   c.move(1,0)
...   sleep(0.05)


** see if you can write these programs:

  - start with a circle where the user clicks, then animate
    the circle to the right, down, left, then back up (so move
    the circle in a square-like pattern)

  - use color_rgb() function to change the color of the circle
    as it moves around the screen