|
|
Summer24
014_quarteredCircles.py
import os
import random
from drawMethods import drawCircle
from util import getTurtleAndScreen
# quartered circles
# CAC, 2024
def drawQuarteredCircle(turtle,x,y,r,colors):
for i in range(4):
turtle.color(random.choice(colors))
drawCircle(turtle,x,y,r,extent=90,start=i*90)
cellSize=50
numCols=18
numRows=12
width=cellSize*numCols
height = cellSize*numRows
sides = random.randrange(3,12)
colors = ["red","yellow",(0,255,0),"#FFFFFF",'#0000BB',(127,127,127),"turquoise","#E8205A"]
filename = os.path.basename(__file__)[0:-3]
turtle, screen = getTurtleAndScreen("Polygons: "+str(sides),width,height,filename,moveWorld=True)
screen.bgcolor("tan")
percent = .75
radius = percent*cellSize/2
for row in range (0,numRows):
for col in range(0,numCols):
x = col * cellSize + cellSize/2
y= row * cellSize + cellSize/2
drawQuarteredCircle(turtle, x, y, radius, colors)
screen.mainloop()
|