mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-09-11 15:39:43 +00:00
30 lines
783 B
Python
30 lines
783 B
Python
#!/usr/bin/env python
|
|
from deps.samplebase import SampleBase
|
|
from rgbmatrix import graphics
|
|
import time
|
|
|
|
|
|
class Text(SampleBase):
|
|
def __init__(self, *args, **kwargs):
|
|
super(Text, self).__init__(*args, **kwargs)
|
|
self.parser.add_argument("-t", "--text", help="The text to scroll on the RGB LED panel", default="Hello world!")
|
|
|
|
def run(self):
|
|
offscreen_canvas = self.matrix.CreateFrameCanvas()
|
|
font = graphics.Font()
|
|
font.LoadFont("deps/fonts/9x18B.bdf")
|
|
text_color = graphics.Color(255, 255, 255)
|
|
|
|
offscreen_canvas.Clear()
|
|
graphics.DrawText(offscreen_canvas, font, 0, 18, text_color, self.args.text)
|
|
self.matrix.SwapOnVSync(offscreen_canvas)
|
|
|
|
while True:
|
|
time.sleep(0.05)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
text = Text()
|
|
if not text.process():
|
|
text.print_help()
|