diff --git a/files/python-scripts/copy.py b/files/python-scripts/copy.py index 4fab9a9..44f0bae 100644 --- a/files/python-scripts/copy.py +++ b/files/python-scripts/copy.py @@ -43,8 +43,18 @@ device_used = sh1106(serial, rotate=2) #sh1106 # get udev context def main(): + regulator = framerate_regulator(fps=10) + img_path = str(Path(__file__).resolve().parent.joinpath('images', 'copy.gif')) + copy_gif = Image.open(img_path) + size = [min(*device_used.size)] * 2 + posn = ((device_used.width - size[0]) // 2,device_used.height - size[1]) + while True: - time.wait(2) + for frame in ImageSequence.Iterator(copy_gif): + with regulator: + background = Image.new("RGB", device_used.size, "white") + background.paste(frame.resize(size, resample=Image.LANCZOS), posn) + device_used.display(background.convert(device_used.mode)) if __name__ == "__main__": try: