-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
60 lines (48 loc) · 1.26 KB
/
main.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
57
58
59
60
import ink_display as ink
import logging
logging.basicConfig(level=logging.DEBUG)
ink = ink.InkDisplay()
image = "zelda00.bmp"
font = "Font.ttc"
def main():
try:
# INIT/CLEAR
ink.init()
ink.clear()
# DISPLAY IMAGE
ink.display_image(image)
ink.clear()
# CREATE DRAW
draw_image = ink.blank_image()
draw = ink.draw(draw_image)
ink.draw_text(
(5, 0), text="hello", font=font, size=24, color="#FF0000", draw=draw
)
ink.draw_text(
(5, 30), text="world", font=font, size=16, color="#FF0000", draw=draw
)
logging.info("drawing draw image")
draw.line([(5, 170), (80, 245)], fill="#0000FF")
ink.display_draw(draw_image)
ink.clear()
# CREATE NEW DRAW
draw_image = ink.blank_image()
draw = ink.draw(draw_image)
ink.draw_text(
(5, 0),
text="goodbye world",
font=font,
size=36,
color="#00FF00",
draw=draw,
)
ink.display_draw(draw_image)
ink.clear()
# SLEEP
ink.sleep()
except IOError as e:
logging.info(e)
except KeyboardInterrupt:
ink.exit()
exit()
main()