def _init_display(): epd = epd3in7.EPD() epd.init(0) epd.Clear(0xFF, 0) epd.init(1) epd.Clear(0xFF, 1) return epd
def resetEpaper(): global epd epd = epd3in7.EPD() logging.info("init and Clear, NOW WAIT") time.sleep(.2) reset(0, 1) reset(0, 2) reset(1, 1) reset(1, 2) # update screen before loop updateScreen()
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib') if os.path.exists(libdir): sys.path.append(libdir) import logging from waveshare_epd import epd3in7 import time from PIL import Image, ImageDraw, ImageFont import traceback logging.basicConfig(level=logging.DEBUG) try: logging.info("epd3in7 Demo") epd = epd3in7.EPD() logging.info("init and Clear") epd.init(0) epd.Clear(0xFF, 0) font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24) font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) # Drawing on the Horizontal image logging.info("1.Drawing on the Horizontal image...") Himage = Image.new('L', (epd.height, epd.width), 0xFF) # 0xFF: clear the frame draw = ImageDraw.Draw(Himage) draw.text((10, 0), 'hello world', font=font24, fill=0) draw.text((10, 20), '3.7inch e-Paper', font=font24, fill=0) draw.text((10, 100), u'微雪电子', font=font24, fill=epd.GRAY1)