forked from ThePiHut/rgbxmastree
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1a0ff0
commit 028d5a8
Showing
1 changed file
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |