# ShowStar.py """ Illustrates the procedure DrawStar and the thirteen "built-in" colors that are part of the module simpleGraphics. """ from simpleGraphics import * # Create a figure with a plot window that displays MakeWindow(6,bgcolor=BLACK,labels=False) # We draw 3 rows of 4 stars inside this rectangle: DrawRect(0,0,10,8,color=DARKGRAY) # The stars will have radius r and lower left star has center at (x,y). r = 1.; x = -3; y = -2 # The center-to-center distance between the star centers will be h. h = 2.2 # Draw the bottom row of stars along y = -2 DrawStar(x,y,r,color=YELLOW) DrawStar(x+h,y,r,color=CYAN) DrawStar(x+2*h,y,r,color=MAGENTA) DrawStar(x+3*h,y,r,color=WHITE) # Draw the middle row of stars along y = -2+h DrawStar(x,y+h,r,color=ORANGE) DrawStar(x+h,y+h,r,color=LIGHTGRAY) DrawStar(x+2*h,y+h,r,color=PURPLE) DrawStar(x+3*h,y+h,r,color=PINK) # Draw the top row of stars along y = -2+2*h DrawStar(x,y+2*h,r,color=GREEN) DrawStar(x+h,y+2*h,r,color=BLUE) DrawStar(x+2*h,y+2*h,r,color=BLACK) DrawStar(x+3*h,y+2*h,r,color=RED) # Create another figure window. MakeWindow(6,bgcolor=BLACK,labels=False) # Draw four tilted stars centered at (0,-3), (3,0), (0,3), and (-3,0) DrawStar(0,-3,2,color=YELLOW) DrawStar(3,0,2,color=YELLOW,rotate=18) DrawStar(0,3,2,color=YELLOW,rotate=36) DrawStar(-3,0,2,color=YELLOW,rotate=-18) ShowWindow()