diff --git a/examples/randomsparkles.py b/examples/randomsparkles.py index 832e0a6..5b4db35 100644 --- a/examples/randomsparkles.py +++ b/examples/randomsparkles.py @@ -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()