def main(): import logging from waveshare_epd import epd2in13_V2 import time from PIL import Image,ImageDraw import os fontpath = os.path.realpath(os.path.join(__file__,"..","..","wavesharelib","pic", 'Font.ttc')) import simpilib text = simpilib.getQuote() epd = epd2in13_V2.EPD() logging.info("init and Clear") epd.init(epd.FULL_UPDATE) epd.Clear(0xFF) image = Image.new('1', (epd.height, epd.width), 255) draw = ImageDraw.Draw(image) text, longline = simpilib.wrapText(text) font = simpilib.loadFontSize(text, draw, image, fontpath) w, h = draw.textsize(text, font=font) center = ( int((epd.height-w)/2), int((epd.width-h)/2) ) print("Drawing:", (w, h), (epd.height, epd.width)) draw.text(center, text, align="center", font = font, fill = 0) # epd.display(epd.getbuffer(image.rotate(180))) epd.display(epd.getbuffer(image)) epd.sleep() epd.Dev_exit() def parser(): from argparse import ArgumentParser p = ArgumentParser() return p