Python_HAT_E-INK_demo_code/main.py

26 lines
695 B
Python

#!/usr/bin/python
# -*- coding:utf-8 -*-
import epd2in13
import time
from PIL import Image,ImageDraw,ImageFont
import traceback
def sendUpdate():
epd = epd2in13.EPD()
epd.init(epd.FULL_UPDATE)
epd.Clear(0xFF)
# Drawing on the image
image = Image.new('1', (epd2in13.EPD_HEIGHT, epd2in13.EPD_WIDTH), 255) # 255: clear the frame
message = "testing 123 what is going\n on ahbfuasdfhkgasyudgfuasykgdf"
while True:
font15 = ImageFont.truetype('wqy-microhei.ttc', 20)
draw.text((3, 3), '{}'.format(message), font = font15, fill = 0)
epd.display(epd.getbuffer(image))
time.sleep(20)