mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-11-14 08:53:49 +00:00
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
#!/usr/bin/env python
|
|
from ..samplebase import SampleBase
|
|
from rgbmatrix import graphics
|
|
import time, keyboard, os
|
|
|
|
|
|
class TextMenu(SampleBase):
|
|
def __init__(self, *args, **kwargs):
|
|
super(TextMenu, self).__init__(*args, **kwargs)
|
|
|
|
def run(self):
|
|
offscreen_canvas = self.matrix.CreateFrameCanvas()
|
|
font = graphics.Font()
|
|
font.LoadFont("7x13.bdf")
|
|
textColor = graphics.Color(255, 255, 255)
|
|
my_text = "hahahahahahah"
|
|
|
|
while True:
|
|
offscreen_canvas.Clear()
|
|
len = graphics.DrawText(offscreen_canvas, font, 7, 13, textColor, my_text)
|
|
if (keyboard.is_pressed('1')):
|
|
os.system('sudo /var/SnakeGame/Client/SnakeGame')
|
|
break
|
|
elif (keyboard.is_pressed('2')):
|
|
os.system('sudo /var/FlappyBird/FlappyBird')
|
|
break
|
|
time.sleep(0.05)
|
|
offscreen_canvas = self.matrix.SwapOnVSync(offscreen_canvas)
|
|
|
|
|
|
# Main function
|
|
if __name__ == "__main__":
|
|
run_text = TextMenu()
|
|
if (not run_text.process()):
|
|
run_text.print_help()
|