Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main


Python


C++
JAVA
PHP
SQL
Assignments

Summer24


010_RandomPartialCircles.py

import os
import random

from drawMethods import drawCircle
from palettes import randomNamedPalette
from util import getTurtleAndScreen
# Random Partial Circles
# CAC, 2024

width=1600
height = 900
name,palette = randomNamedPalette()

filename = os.path.basename(__file__)[0:-3]
turtle, screen = getTurtleAndScreen("Random Partial Circles ("+name+")",width,height,filename,moveWorld=True)

bgcolor = random.choice(palette)
screen.bgcolor(bgcolor)
palette.remove(bgcolor)

for i in range(100):
    x = random.randint(0,width)
    y = random.randint(0,height)
    radius = random.randint(50,150)
    startAngle = random.randint(0,360)
    howManyDegrees = random.randint(90,360)
    turtle.color(random.choice(palette))
    drawCircle(turtle,x,y,radius,start=startAngle,extent=howManyDegrees)

screen.mainloop()