CounterDemo.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:pydrm 作者: notro 项目源码 文件源码
def demo(drm, start):
    """simple partial update demo - draw random shapes"""

    # Use a monochrome image to force 0/1 values
    image = Image.new('1', drm.image.size)

    # prepare for drawing
    draw = ImageDraw.Draw(image)
    width, height = drm.image.size

    font = ImageFont.truetype(FONT_FILE, FONT_SIZE)

    counter = start & 0xffff

    while True:
        draw.rectangle((0, 0, width, height), fill='black', outline='black')
        draw.text((0, 0), '{c:04X}'.format(c=counter), fill='white', font=font)
        counter = (counter + 1) & 0xffff

        # display image on the panel
        image.convert('RGBX')
        drm.image.paste(image)
        drm.flush()

# main
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号