# Allison Obourn
# CS 115, Autumn 2021
# Lecture 11

# This program draws random sized ovals on the canvas at random locations.
# These locations will always allow the entire circle to fit on the canvas.
# The circles are random shapes of blue. They appear one at a time.

from ECGUI import *
from random import *

# constants the user can change in one place that will change the output
# of our entire program.
PANEL_WIDTH = 500 # the width of the drawing window
PANEL_HEIGHT = 200 # the height of the drawing window
MAX_CIRCLE_WIDTH = # 40 the maximum permitted width for each raindrop

def repeat():
    circle_width = randint(20, MAX_CIRCLE_WIDTH)
    circle_height = randint(10, MAX_CIRCLE_WIDTH)
    
    rand_x = randint(0, PANEL_WIDTH - circle_width)
    rand_y = randint(0, PANEL_HEIGHT - circle_height)

    # generating a random color string starting with #3333 every time and
    # containing two random digits at the end
    blue = "#3333"
    first_blue_digit = randint(4, 9)
    second_blue_digit = randint(4, 9)
    blue_color = blue + str(first_blue_digit) + str(second_blue_digit)
    
    panel.fill_oval(rand_x, rand_y, circle_width, circle_height, blue_color)


panel = drawing_panel(PANEL_WIDTH, PANEL_HEIGHT, "yellow")
panel.animate(50, repeat)
