A GUI app in python to manage the cash for coffee with a Raspberry Pi.
- 1. Annotations
- 2. Pictures
- 3. Install Python 3.9
- 4. Hide cursor in Raspbian
- 5. Download on your raspberry pi
- 6. Install ttkbootstrap
- 7. Automatically start the python app script on startup
- Readme under construction
- Raspberry pi 2b model was used
- Python 3.9 was used for the program
- Ensure installation of tk bootstrap for extended gui visuals
To install Python 3.9 on a Raspberry Pi running the Raspberry Pi OS, follow these steps:
-
Open the terminal on your Raspberry Pi.
-
Update the package list and upgrade the system packages by running the following commands:
sudo apt-get update sudo apt-get upgrade
-
Install the prerequisites needed to build Python from source:
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
-
Download the latest version of Python 3.9 from the official website using the following command:
wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz
-
Extract the downloaded archive using the following command:
tar -xf Python-3.9.9.tgz
-
Change into the extracted directory using the following command:
cd Python-3.9.9
-
Configure the build process using the following command:
./configure --enable-optimizations
-
Start the build process using the following command:
make
-
Install Python 3.9 using the following command:
sudo make altinstall
Note: the "altinstall" option will install Python 3.9 alongside the system's default Python version, which is typically Python 3.7 on Raspberry Pi OS.
-
Verify that Python 3.9 is installed by running the following command:
python3.9 --version
That's it! You now have Python 3.9 installed on your Raspberry Pi.
-
Open the terminal on your Raspberry Pi.
-
Edit the lightdm.conf file using the following command:
sudo nano /etc/lightdm/lightdm.conf
-
Add the following line to the [Seat*:] section of the file:
xserver-command=X -nocursor
-
Save the changes by pressing Ctrl+O and Ctrl+X.
-
Restart the Raspberry Pi to see the changes take effect:
sudo reboot
-
Download the latest stable release:
wget https://github.com/m31L3r/coffeebox/archive/refs/tags/V1.3.tar.gz
-
Unpack the downloaded file:
tar -xf V1.3.tar.gz
To install ttkbootstrap on a Raspberry Pi, you simply run:
sudo pip3.9 install ttkbootstrap
You can use the /etc/xdg/autostart directory to autostart your Python script. This directory contains .desktop files that are used to automatically start applications when the desktop environment starts up.
-
Open a text editor and create a new file. Name the file something like
my_program.desktop
. -
Add the following lines to the file:
[Desktop Entry] Type=Application Name=My Program Exec=/usr/bin/python3 /path/to/your/python/program.py
Replace
My Program
with the name of your program,/usr/bin/python3
with the path to your Python interpreter, and/path/to/your/python/program.py
with the actual path to your Python program. -
Save the file in the
/etc/xdg/autostart
directory. -
Reboot your Raspberry Pi to apply the changes:
sudo reboot
Now your Python script should automatically start when the desktop environment starts up. Note that this method assumes that you're using a desktop environment that reads the .desktop
files in the /etc/xdg/autostart directory
, such as LXDE or Xfce. If you're using a different desktop environment or window manager, you may need to use a different method to autostart your program.