Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # tk_justrandomdots.py
- import tkinter as tk
- import random
- ww = hh = 600
- def generate_pattern():
- for _ in range(1200):
- x = random.randint(0, ww)
- y = random.randint(0, hh)
- r = random.randint(0, 255)
- g = random.randint(0, 255)
- b = random.randint(0, 255)
- size = random.randint(1, 20)
- canvas.create_oval(x, y, x+size, y+size, fill=f'#{r:02x}{g:02x}{b:02x}', outline='')
- root = tk.Tk()
- canvas = tk.Canvas(root, width=ww, height=hh)
- canvas.pack()
- generate_pattern()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement