コード例 #1
0
ファイル: display.py プロジェクト: kirberich/e_ink_billboard
class Display:
    def __init__(self, saturation=0.5):
        self.inky = Inky()
        self.saturation = saturation

    def resize_for_screen(self, image):
        copied = image.copy()

        # Apply rotation in exif data
        copied = ImageOps.exif_transpose(image)

        copied.thumbnail([600, 448])
        size = copied.size
        print(size)
        background = Image.new("RGB", (600, 448), (255, 255, 255))
        background.paste(copied, (int(
            (600 - size[0]) / 2), int((448 - size[1]) / 2)))
        return background

    def _show_latest(self):
        latest_image = self.resize_for_screen(Image.open("latest"))

        self.inky.set_image(latest_image, saturation=self.saturation)
        self.inky.show(busy_wait=False)
        print("done")

    def show_latest(self):
        task = threading.Thread(target=self._show_latest, args=())
        task.start()
コード例 #2
0
ファイル: clear.py プロジェクト: m-clare/tinky-care
def clear_inky():
    inky = Inky()

    for _ in range(4):
        for y in range(inky.height - 1):
            for x in range(inky.width - 1):
                inky.set_pixel(x, y, CLEAN)

        inky.show()
        time.sleep(1.0)
コード例 #3
0
#!/usr/bin/env python3
import time

from inky.inky_uc8159 import Inky

inky = Inky()

colors = ['Black', 'White', 'Green', 'Blue', 'Red', 'Yellow', 'Orange']

for color in range(7):
    print("Color: {}".format(colors[color]))
    for y in range(inky.height):
        for x in range(inky.width):
            inky.set_pixel(x, y, color)
    inky.set_border(color)
    inky.show()
    time.sleep(5.0)