Esempio n. 1
0
async def shutdown():
    from nonebot import require
    scheduler = require('nonebot_plugin_apscheduler').scheduler
    if scheduler.running:
        scheduler.shutdown()
    if platform.system() == "Linux":
        from waveshare_epd import epd1in54
        epd = epd1in54.EPD()
        epd.init(epd.lut_full_update)
        epd.Clear(0xFF)

        img = Image.new("1", (200, 200), 0xFF)
        draw = ImageDraw.Draw(img)
        draw.rectangle((0, 0, 199, 199), outline=0x00)

        draw.text((33, 33), "Good\nNight", fill=0x00, font=font_50)
        epd.display(epd.getbuffer(img))
Esempio n. 2
0
libdir = os.path.join(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 epd1in54
import time
from PIL import Image,ImageDraw,ImageFont
import traceback

logging.basicConfig(level=logging.DEBUG)

try:
    logging.info("epd1in54 Demo")
    
    epd = epd1in54.EPD()
    logging.info("init and Clear")
    epd.init(epd.lut_full_update)
    epd.Clear(0xFF)
    
    # Drawing on the image
    logging.info("1.Drawing on the image...")
    image = Image.new('1', (epd.width, epd.height), 255)  # 255: clear the frame
    
    draw = ImageDraw.Draw(image)
    font = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 24)
    draw.rectangle((0, 10, 200, 34), fill = 0)
    draw.text((8, 12), 'hello world', font = font, fill = 255)
    draw.text((8, 36), u'微雪电子', font = font, fill = 0)
    draw.line((16, 60, 56, 60), fill = 0)
    draw.line((56, 60, 56, 110), fill = 0)