# Day 15
#     __                 _                     ___
#    /__\ __ _ _ __   __| | ___  _ __ ___     / __\__ _ _ ____   ____ _ ___
#   / \/// _` | '_ \ / _` |/ _ \| '_ ` _ \   / /  / _` | '_ \ \ / / _` / __|
#  / _  \ (_| | | | | (_| | (_) | | | | | | / /__| (_| | | | \ V / (_| \__ \
#  \/ \_/\__,_|_| |_|\__,_|\___/|_| |_| |_| \____/\__,_|_| |_|\_/ \__,_|___/

from tkinter import *
import random
import time

root=Tk()
root.title("Canvas Objects")
root.geometry("1200x720+1+1")

c=Canvas(root,width=1200,height=680,bg="black")
c.place(x=10,y=10)

# define image
img = PhotoImage(file='phodo/bawlin.png').subsample(2,2)

# make a thounsand objetcs
for i in range (1,10000):

    # roll for shape
    shape = random.randint(1,7)

    #roll for color
    color = ["#" + ''.join([random.choice('ABCDEF0123456789') for i in range(6)])]

    # roll for width
    width = random.randint(1, 10)

    # roll for text size
    textsize = random.randint(1, 60)

    # roll for coordinates
    x0 = random.randint(1,1200)
    y0 = random.randint(1,680)
    x1 = random.randint(1,1200)
    y1 = random.randint(1,680)
    x2 = random.randint(1,1200)
    y2 = random.randint(1,680)
    x3 = random.randint(1,1200)
    y3 = random.randint(1,680)
    x4 = random.randint(1,1200)
    y4 = random.randint(1,680)
    x5 = random.randint(1,1200)
    y5 = random.randint(1,680)

    # pick shape
    if shape == 1: # rectangle
        c.create_rectangle(x0, y0, x1, y1, fill=color)

    elif shape == 2: # circle
        c.create_oval(x0, y0, x1, y1, fill=color)

    elif shape == 3: # line
        c.create_line(x0, y0, x1, y1, fill=color, width=width)

    elif shape == 4: # polygon
        c.create_polygon(x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, fill=color)

    elif shape == 5: # arc
        c.create_arc(x0, y0, x1, y1, fill=color, style=ARC, width=width)

    elif shape == 6: # text
        c.create_text((x0, y0), text="We Ballin'", fill=color, font="Helvetica " + str(textsize))

    elif shape == 7: #FIXME:
        c.create_image(x0, y0, image=img)

    time.sleep(.02)
    root.update()


root.mainloop()