31 lines
785 B
Python
31 lines
785 B
Python
#!/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)
|