# File: ChapterGraphics/colorsRand.py """ Random colored circles mycolor = color_rgb(r,g,b) # mix your own color 255 240 245 LavenderBlush 255 228 225 MistyRose 255 255 255 white 0 0 0 black 105 105 105 DimGrey """ from graphics import * import random winx,winy = 500, 300 # window geometry def main(): win = GraphWin( "7 Random colored circles", winx, winy ) for i in range(7): x=random.randint(10,winx) # choose random center of the circle y=random.randint(10,winy) c = Circle(Point(x,y) , 10 ) # make a circle radius 10 r=random.randint(0, 255) # RED Integer from 0 to 255 g=random.randint(0, 255) # GREEN Integer from 0 to 255 b=random.randint(0, 255) # BLUE Integer from 0 to 255 mycolor = color_rgb(r,g,b) # mix your own color c.setFill( mycolor ) # c.setFill("MistyRose") c.draw( win ) # draw circle with random color main()