This commit is contained in:
Christoph Haas 2025-11-18 22:40:58 +01:00
commit 9bd764579a
5 changed files with 123 additions and 0 deletions

31
scenes/helloworld.py Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env python3
import io
from time import sleep
from PIL import Image, ImageDraw, ImageFont
from lib import display
# TODO: Derive from number of panels and panel size
matrix_height = 64
matrix_width = 64 * 2
# Load a font (use a TTF font file of your choice)
try:
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 12)
except IOError:
font = ImageFont.load_default()
def start(image_buffer, stop_event, text="Hello World!"):
t = 0
while not stop_event.is_set():
image_buffer = Image.new("RGB", (128, 64))
draw = ImageDraw.Draw(image_buffer)
draw.text((0, 0), f"Hello World {t}", fill=(255, 255, 255), font=font)
t += 1
print(t)
#image_buffer.save('image.png')
display.do(image_buffer)
sleep(0.2)