Skip to content

Commit

Permalink
Simplify random sparkles example
Browse files Browse the repository at this point in the history
  • Loading branch information
bennuttall committed Dec 17, 2019
1 parent f1a0ff0 commit 028d5a8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions examples/randomsparkles.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
from tree import RGBXmasTree
from random import random
import random

tree = RGBXmasTree()

def random_color():
r = random()
g = random()
b = random()
r = random.random()
g = random.random()
b = random.random()
return (r, g, b)

def random_colors(n):
return [random_color() for i in range(n)]

try:
while True:
tree.value = random_colors(25)
pixel = random.choice(tree)
pixel.color = random_color()
except KeyboardInterrupt:
tree.close()

0 comments on commit 028d5a8

Please sign in to comment.