matekasse_NFC-Reader/oled.py
2024-04-12 20:01:38 +02:00

26 lines
796 B
Python

from luma.core.interface.serial import i2c, spi, pcf8574
from luma.core.interface.parallel import bitbang_6800
from luma.core.render import canvas
from luma.oled.device import ssd1306
from PIL import ImageFont
from pathlib import Path
import time
serial = i2c(port=1, address=0x3C)
device = ssd1306(serial)
#fonts
name_font=ImageFont.truetype("Purisa.ttf", 20)
name_position=(50,0)
user_id_font=ImageFont.truetype("Purisa.ttf", 20)
user_id_position=(30,0)
def balance(user_name, balance):
with canvas(device) as draw:
pass
with canvas(device) as draw:
#draw.rectangle(device.bounding_box, outline="white", fill="black")
draw.text(user_id_position, "1", fill="white", font=(user_id_font))
draw.text(name_position, "Test", fill="white", font=(name_font))
time.sleep(10)