Matrix/API/main.py
2023-11-22 16:44:26 +01:00

30 lines
783 B
Python

#!/usr/bin/env python
from deps.samplebase import SampleBase
from rgbmatrix import graphics
import time
class Test(SampleBase):
def __init__(self, *args, **kwargs):
super(Test, 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__":
test = Test()
if not test.process():
test.print_help()