Since I figured out how to get a shutdown button on my RPI PaPiRus Zero here:

https://forum.modmypi.com/technical-support/programming-papirus-buttons-t1700.html

I started getting the other buttons programmed. Right now I also have the button 1 near the HDMI jack programmed to display an image. The image is a portrait orientation so --rotation 90 in my batch script. First I did an edit to /usr/local/bin/papirus-draw (back up your original file) and set the array from ending at 5 to 1 since I don't want my image flipping all over the place for 10 seconds. Here's the way it was:

Code: Select all

for i in range(0, 5):


And changed it to this:

Code: Select all

for i in range(0, 1):


Then make a simple batch file to display your 200 X 96 image:

Code: Select all

#! /bin/sh
sudo papirus-draw --rotate 90 /home/pi/PaPiRus/IMAGE.gif


Then make a python script to bind this to a button. I called mine wallpaper.py:

Code: Select all

#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess

GPIO.setmode(GPIO.BCM)
# set pin 21 to input
GPIO.setup(21, GPIO.IN)

oldButtonState1 = True
while True:
    buttonState1 = GPIO.input(21)

    if buttonState1 != oldButtonState1 and buttonState1 == False :
        print "Button 1 pressed-New wallpaper"
        subprocess.call("papirus-draw --rotate 90 /home/pi/PaPiRus/IMAGE.gif", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

    oldButtonState1 = buttonState1

    time.sleep(.1)


Run the script with:

Code: Select all

sudo python wallpaper.py


If u get no errors, press button 1 near the HDMI jack and your portrait oriented image should display. Delete rotation command for landscape. Then I put mine is sudo crontab -e

Code: Select all

@reboot sudo python /home/pi/PaPiRus/Buttons/wallpaper.py


I think I'll tie the papirus time to another switch. Hope it works for u!

Marty