-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsoleLedLine.py
39 lines (28 loc) · 902 Bytes
/
ConsoleLedLine.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
import sys
from colr import trans, controls
from LedLine import LedLine
class ConsoleLedLine(LedLine):
"""
LedLine which is visualised using console.
"""
_bar_width = 0
_bar_height = 30
def __init__(self, size: int):
super().__init__(size)
def DisplayLine(self):
controls.pos_save()
controls.move_pos(0, 0)
for pixel in self._leds:
sys.stdout.write('\033[48;5;{code}m \033[0m'.format(code=trans.rgb2term(pixel.get_red() * 255,
pixel.get_green() * 255,
pixel.get_blue() * 255)))
controls.pos_restore()
def PreUpdate(self):
def pre_update():
# controls.erase_display(2)
pass
return pre_update
def PostUpdate(self):
def post_update():
pass
return post_update