many works
This commit is contained in:
parent
9bd764579a
commit
c937450f92
7 changed files with 151 additions and 36 deletions
|
|
@ -3,29 +3,21 @@
|
|||
import io
|
||||
from time import sleep
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from lib import display
|
||||
#from lib import display
|
||||
import lib.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!"):
|
||||
def start(stop_event, text="Hello World!"):
|
||||
t = 0
|
||||
while not stop_event.is_set():
|
||||
image_buffer = Image.new("RGB", (128, 64))
|
||||
#image_buffer = Image.new("RGB", (lib.display.matrix_width, lib.display.matrix_height))
|
||||
image_buffer = lib.display.matrix.buffer()
|
||||
draw = ImageDraw.Draw(image_buffer)
|
||||
draw.text((0, 0), f"Hello World {t}", fill=(255, 255, 255), font=font)
|
||||
draw.text((0, 0), f"Hello World {t}", fill=(255, 255, 255), font=lib.display.matrix.font)
|
||||
|
||||
t += 1
|
||||
print(t)
|
||||
|
||||
#image_buffer.save('image.png')
|
||||
display.do(image_buffer)
|
||||
lib.display.matrix.show(image_buffer)
|
||||
|
||||
#sleep(0.2)
|
||||
|
||||
sleep(0.2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue