This commit is contained in:
2024-01-12 19:23:12 +01:00
parent feefacdd8e
commit f46846645c
+12 -11
View File
@@ -2,12 +2,12 @@
# -*- coding:utf-8 -*-
import sys
import os
import logging
import time
from PIL import Image,ImageDraw,ImageFont,ImageShow
import traceback
import argparse
from random import randint
from PIL import Image,ImageDraw,ImageFont,ImageShow
parser = argparse.ArgumentParser(description='e-Ink Sheogorath')
parser.add_argument('--debug', action='store_true', help='If true, does not initialize e-Ink, shows images in window')
@@ -60,27 +60,28 @@ try:
draw.polygon([(190,0),(190,50),(150,25)],fill = 0)
draw.text((120, 60), 'e-Paper demo', font = font15, fill = 0)
draw.text((110, 90), u'', font = font24, fill = 0)
epd.display(epd.getbuffer(image))
time.sleep(2)
# read bmp file on window
logging.info("3.read bmp file on window...")
epd.Clear(0xFF)
image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
#image1 = Image.new('1', (epd.height, epd.width), 255) # 255: clear the frame
bmp = Image.open('res/sheo1.bmp')
time_image = Image.new('1', (epd.height, epd.width), 255)
time_draw = ImageDraw.Draw(time_image)
epd.init(epd.FULL_UPDATE)
time_image.paste(bmp, (2,2))
epd.displayPartBaseImage(epd.getbuffer(time_image))
#epd.init(epd.FULL_UPDATE)
#epd.displayPartBaseImage(epd.getbuffer(time_image))
epd.init(epd.PART_UPDATE)
while (True):
time_image = Image.new('1', (epd.height, epd.width), 255)
time_draw = ImageDraw.Draw(time_image)
time_image.paste(bmp, (2,2))
time_draw.rectangle((160, 90, 250, 122), fill = 255)
time_draw.text((160, 90), time.strftime('%H:%M'), font = font24, fill = 0)
time_draw.text((140, 10), 'Respect your \nparents, okay?', font = font15, fill = 0)
epd.displayPartial(epd.getbuffer(time_image))
time.sleep(5)
epd.displayPartial(epd.getbuffer(time_image))
epd.displayPartial(epd.getbuffer(time_image))
time.sleep(10)
except IOError as e:
logging.info(e)
except KeyboardInterrupt: