-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
34 lines (28 loc) · 920 Bytes
/
test.py
File metadata and controls
34 lines (28 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from protree.tree import Tree, TreeBuilder
from protree.treeDrawer import drawTree, drawLastBranches, drawTreeMultiColor
from protree.sinter import SuccesiveInterval
from pyglet.window import Window, key
from pyglet.gl import Config, glClearColor
from pyglet import app
t = Tree()
tb = TreeBuilder()
colors = SuccesiveInterval([(8, (64, 0, 0, 255)), (5, (240, 40, 170, 64))])
config = Config(alpha_size=8)
w = Window(config=config)
glClearColor(0.2, 0.2, 1.0, 0.5)
@w.event
def on_key_press(symbols, modifier):
global t
global tb
if symbols is key.R:
t = Tree()
w.clear()
drawTree(t, 300, 0, 200, 20, 255, 255, 255, 16)
if symbols is key.N:
tb.addBranchesToEnd(t)
drawLastBranches(t, 300, 0, 200, 20, 255, 255, 255, 16)
print('Done Drawing')
if symbols is key.D:
w.clear()
drawTreeMultiColor(t, 300, 0, 200, 20, colors)
app.run()