An update - My code is buggy but I figured out how to achieve what I was trying to do so far I have pasted the code below. It starts by opening a completely white image and then waits for a button press which will load up whatever image is stored.
#!/usr/bin/env python
import time
import subprocess
import signal
from PIL import Image
import sys
import buttonshim
from inky import InkyPHAT
print(""“It can only fail.
“””)
inky_display = InkyPHAT(“red”)
cooldown = time.time() - 2.5
lastbutton = “”
#inky_display.colour = ‘black’
#inky_display.set_border(1)
#inky_display.rectangle((0,0, 212,104), fill=1, outline=0)
def flash(length, col):
if col == 1: #red
buttonshim.set_pixel(255,0,0)
else: # green
buttonshim.set_pixel(0,255,0)
time.sleep(length)
def display(image,button):
global cooldown
global lastbutton
if lastbutton == button:
print(“go easy”)
return
elif time.time() - cooldown < 2.5:
print(“Just no”)
return
else:
flash(0,1)
inky_display.set_image(Image.open(image))
inky_display.show()
cooldown = time.time()
lastbutton = button
flash(2.5, 2)
display("/home/pi/Pimoroni/inky/examples/img/imgwht.png", “0”)
# Button A
@buttonshim.on_release(buttonshim.BUTTON_A)
def button_a(button, pressed):
display("/home/pi/Pimoroni/inky/examples/img/img1.png", “a”)
Button B
@buttonshim.on_release(buttonshim.BUTTON_B)
def button_b(button, pressed):
display("/home/pi/Pimoroni/inky/examples/img/img2.png", “b”)
# Button C
@buttonshim.on_release(buttonshim.BUTTON_C)
def button_b(button, pressed):
display("/home/pi/Pimoroni/inky/examples/img/img3.png", “b”)
# Button D
@buttonshim.on_release(buttonshim.BUTTON_D)
def button_b(button, pressed):
display("/home/pi/Pimoroni/inky/examples/img/img4.png", “b”)
# Button E
@buttonshim.on_release(buttonshim.BUTTON_E)
def button_b(button, pressed):
display("/home/pi/Pimoroni/inky/examples/img/img5.png", “b”)
signal.pause()