Created
May 2, 2020 19:43
-
-
Save jantznick/f8a3ad9bcb3a039ca539070fb8faed24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from PIL import ImageFont | |
from luma.core.interface.serial import spi, noop | |
from luma.core.render import canvas | |
from luma.core.virtual import viewport | |
from luma.led_matrix.device import max7219 | |
font = ImageFont.truetype("pixelmix.ttf", 8) | |
serial = spi(port=0, device=0, gpio=noop()) | |
device = max7219(serial, cascaded=4, block_orientation=-90) | |
virtual = viewport(device, width=100, height=8) | |
text = "Hello World" | |
while True: | |
with canvas(virtual) as draw: | |
draw.text((32,0), str(text), fill="white", font=font) | |
width,height = font.font.getsize(text) | |
print(width, height, width[0]) | |
for offset in range(100): | |
print(f'Offset: {offset}') | |
virtual.set_position((offset,0)) | |
time.sleep(.1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment