forked from glumpy/glumpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollection-glyph.py
56 lines (49 loc) · 1.85 KB
/
collection-glyph.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
from glumpy import app
from glumpy.graphics.text import FontManager
from glumpy.graphics.collections import GlyphCollection
from glumpy.transforms import Position, Viewport, Trackball
jabberwocky = (
"`Twas brillig, and the slithy toves\n"
" Did gyre and gimble in the wabe:\n"
"All mimsy were the borogoves,\n"
" And the mome raths outgrabe.\n"
"\n"
"\"Beware the Jabberwock, my son!\n"
" The jaws that bite, the claws that catch!\n"
"Beware the Jubjub bird, and shun\n"
" The frumious Bandersnatch!\"\n"
"He took his vorpal sword in hand:\n"
" Long time the manxome foe he sought --\n"
"So rested he by the Tumtum tree,\n"
" And stood awhile in thought.\n"
"And, as in uffish thought he stood,\n"
" The Jabberwock, with eyes of flame,\n"
"Came whiffling through the tulgey wood,\n"
" And burbled as it came!\n"
"One, two! One, two! And through and through\n"
" The vorpal blade went snicker-snack!\n"
"He left it dead, and with its head\n"
" He went galumphing back.\n"
"\"And, has thou slain the Jabberwock?\n"
" Come to my arms, my beamish boy!\n"
"O frabjous day! Callooh! Callay!'\n"
" He chortled in his joy.\n"
"\n"
"`Twas brillig, and the slithy toves\n"
" Did gyre and gimble in the wabe;\n"
"All mimsy were the borogoves,\n"
" And the mome raths outgrabe.\n" )
window = app.Window(width=700, height=700, color=(1,1,1,1))
@window.event
def on_draw(dt):
window.clear()
glyphs.draw()
glyphs = GlyphCollection(transform=Trackball(Position()))
glyphs.append(jabberwocky, FontManager.get("Roboto-Regular.ttf"))
window.attach(glyphs["transform"])
window.attach(glyphs["viewport"])
app.run()