# Program to draw a bunch of random colored circles from myro import * from random import * def makeCircle(x, y, r): # creates a Circle centered at point (x, y) of radius r return Circle(Point(x, y), r) def makeColor(): # creates a new color using random RGB values red = randrange(0, 256) green = randrange(0, 256) blue = randrange(0, 256) return color_rgb(red, green,blue) width = 500 height = 500 def main(): # Create and display a graphics window myCanvas = GraphWin("Cicrles", width, height) myCanvas.setBackground("white") # draw a bunch of random circles with random colors. N = 500 for i in range(N): # pick random center point and radius in the window x = randrange(0, width) y = randrange(0, height) r = randrange(5, 25) c = makeCircle(x, y, r) # select a random color c.setFill(makeColor()) c.draw(myCanvas) main()