Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
579 B
3
Indexable
Never
from tkinter import Canvas, Tk
from PIL import Image, ImageTk
from random import randint

image = Image.open('./img.png')
w, h = image.size
root = Tk()
canvas = Canvas(root, width=w, height=h)
canvas.pack()
while True:
    colors = [
        'white', 'purple', 'pink',
        'red', 'blue', 'green',
        'yellow', 'brown', 'black'
    ]
    x, y = randint(0, w), randint(0, w)
    d = randint(0, int(h/10))
    canvas.create_oval(x, y, x + d, y + d, fill=colors[randint(0, len(colors) - 1)], outline=colors[randint(0, len(colors) - 1)])
    root.update()