Import the library and examples
This commit is contained in:
commit
7ee61b8ed0
7 changed files with 167 additions and 0 deletions
17
Examples/randomsparkles.py
Normal file
17
Examples/randomsparkles.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from tree import RGBXmasTree
|
||||
import random
|
||||
|
||||
tree = RGBXmasTree()
|
||||
|
||||
def random_color():
|
||||
r = random.random()
|
||||
g = random.random()
|
||||
b = random.random()
|
||||
return (r, g, b)
|
||||
|
||||
try:
|
||||
while True:
|
||||
pixel = random.choice(tree)
|
||||
pixel.color = random_color()
|
||||
except KeyboardInterrupt:
|
||||
tree.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue