Use Poisson process to lay out stars.
It actually looks better the other way?
This commit is contained in:
parent
b1fa56ddad
commit
410ebbf428
10
ui.py
10
ui.py
|
|
@ -3,6 +3,7 @@ from tkinter import *
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from PIL.ImageTk import PhotoImage
|
from PIL.ImageTk import PhotoImage
|
||||||
|
|
||||||
|
from poisson import poisson
|
||||||
|
|
||||||
|
|
||||||
class App:
|
class App:
|
||||||
|
|
@ -43,16 +44,19 @@ class App:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from random import randint, expovariate
|
from random import randint, expovariate, seed
|
||||||
|
|
||||||
|
seed(23)
|
||||||
|
|
||||||
width, height = 10240, 7680
|
width, height = 10240, 7680
|
||||||
root = Tk()
|
root = Tk()
|
||||||
app = App(root, bg='black', scrollregion=(0, 0, width, height))
|
app = App(root, bg='black', scrollregion=(0, 0, width, height))
|
||||||
app.frame.pack(expand=True, fill=BOTH)
|
app.frame.pack(expand=True, fill=BOTH)
|
||||||
|
|
||||||
|
k = poisson(width, height, 160)
|
||||||
|
|
||||||
for _ in range(1000):
|
for x, y in k:
|
||||||
x, y = randint(0, width - 1), randint(0, height - 1)
|
#x, y = randint(0, width - 1), randint(0, height - 1)
|
||||||
#radius = randint(2, 10) // 2
|
#radius = randint(2, 10) // 2
|
||||||
radius = round(1 + expovariate(1))
|
radius = round(1 + expovariate(1))
|
||||||
app.canvas.create_oval(
|
app.canvas.create_oval(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue