To note the WichitaLUG meetings got moved online at the moment due to Covid. I’d suggest joining the discord/matrix what have you if you have questions for semi-realtime.
I’m actually setting something like that up. (Though not pi, and not touching GPIO, though I really wish computers had more accessible GPIO.)
I’ll list two ways to launch things:
First way: To launch something automatically as a service, on most systems (using systemd, which almost all distros are) you can use a script similar to this one which I use for an led-blinker (My converted Chromebook has a led light on the back, which I like blinking when it’s on.) let’s call this led_blinker.service
Modify $USER to whatever your username that you want to run it is. Also the path, description and similar.
[Unit]
Description=LED blinker for Candy (Dell Chromebook 3120)
StartLimitIntervalSec=5
After=basic.target
[Service]
Type=simple
Restart=always
RestartSec=5
User=$USER
ExecStart=/usr/bin/python3 /home/$USER/git/candy-led/led.py
[Install]
WantedBy=multi-user.target
To ‘install’ that I’d just go:
sudo systemctl enable $PATH_TO_ABOVE_FILE
sudo systemctl start led_blinker.service
Then it will start each time, and in my case I get pretty colors! (Great for telling if it’s on or asleep)
To stop it:
sudo systemctl start led_blinker.service
To disable it (stop from starting up on startup):
sudo systemctl stop led_blinker.service
To get status it: (No sudo required in most cases)
systemctl status led_blinker.service
Second way: For graphical things using X11: Configured for autologin under X11, you could just add the line to ~/.xinitrc in most cases. Here’s arch’s wiki on it: xinit - ArchWiki (That’s for base X11, some Desktop environments may or may not respect that.)
A Third way would be to use crontab, but that’s usually for things you want to run periodically and have quit. It can also be used to check and launch processes if it dies, but with the line in the .service file systemd will try to handle that. There’s others.
Pygame I think uses the framebuffer/GL directly on Pi, but it’s been a while since I looked at it, so I think the first method would work if that’s all you want to run graphically.