mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-25 11:31:46 +00:00
implemented first test
This commit is contained in:
parent
9914cd4b23
commit
375590d87f
40
API/main.py
40
API/main.py
@ -1,16 +1,32 @@
|
|||||||
# This is a sample Python script.
|
#!/usr/bin/env python
|
||||||
|
from samplebase import SampleBase
|
||||||
# Press Umschalt+F10 to execute it or replace it with your code.
|
from rgbmatrix import graphics
|
||||||
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
|
import time
|
||||||
|
|
||||||
|
|
||||||
def print_hi(name):
|
class Test(SampleBase):
|
||||||
# Use a breakpoint in the code line below to debug your script.
|
def __init__(self, *args, **kwargs):
|
||||||
print(f'Hi, {name}') # Press Strg+F8 to toggle the breakpoint.
|
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/7x13.bdf")
|
||||||
|
textColor = graphics.Color(255, 255, 0)
|
||||||
|
pos = offscreen_canvas.width
|
||||||
|
my_text = self.args.text
|
||||||
|
|
||||||
|
offscreen_canvas.Clear()
|
||||||
|
graphics.DrawText(offscreen_canvas, font, pos, 10, textColor, my_text)
|
||||||
|
offscreen_canvas = self.matrix.SwapOnVSync(offscreen_canvas)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
time.sleep(0.05)
|
||||||
|
|
||||||
|
|
||||||
# Press the green button in the gutter to run the script.
|
# Main function
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
print_hi('PyCharm')
|
test = Test()
|
||||||
|
if (not test.process()):
|
||||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
test.print_help()
|
||||||
|
Loading…
Reference in New Issue
Block a user