Hello, I do the following in Python:
#!/usr/bin/env python3
import sys
import random
import time
from PIL import Image, ImageFont, ImageDraw
from inky.inky_uc8159 import Inky
inky = Inky()
saturation = 0.5
aImageList = [1,2,3]
aColorsList = [3,4,5]
while True:
print("cjf doing clear")
for y in range(inky.height):
color = random.choice(aColorsList)
for x in range(inky.width):
inky.set_pixel(x, y, color)
inky.show()
time.sleep(1.0)
iUseImage = random.choice(aImageList)
sImagePath = "images/project/" + str(iUseImage) + ".png"
print("cjf using image: " + sImagePath)
image = Image.open(sImagePath)
inky.set_image(image, saturation=saturation)
inky.show()
time.sleep(1.0)
Works great first pass.
On the second time around the loop, this error:
Traceback (most recent call last):
File "cjf_image.py", line 25, in <module>
inky.set_pixel(x, y, color)
File "/usr/local/lib/python3.7/dist-packages/inky/inky_uc8159.py", line 342, in set_pixel
self.buf[y][x] = v & 0x07
IndexError: index 448 is out of bounds for axis 0 with size 448
I have no idea why this simple script would be giving an error. Is there some syntax error I’m not aware of. Otherwise is there an issue doing set_pixel after set_image?