GUI
Tkinter is a built in GUI library for python. Although not the prettiest themed GUI, It’s easy to use. Especially for our application using the raspberry pi for running the GUI which is as simple as running the python script in IDLE which comes with Raspbian OS.
I decided to use a grid view for drink selections. Each drink would be displayed with a picture of the drink with the name then a short list of the ingredients following. Last would be a button to activate the machine to start making the drink. I decided to make the button big for the touch screen so it was easier for the user to click the button on the first try. I embedded the picture and Drink name into the button which flowed well with having a big button. The tkinter library only accepts .gif, .pgm, or .ppm picture formats. After finding the picture I wanted to use I resized the image and converted it to a .gif. I saved the picture into the project folder alongside the .py file. When running the script the code looks for the image file in the same folder as the .py file.
The script starts with importing the necessary libraries. The Tkinter Library is imported along with the Pyserial library for serial communication. The serial port is then set up telling the Pi to use the USB port as the serial port at 9600 baud. Next we set up the GUI’s attributes. We assign the GUI as dgui. i.e. dgui = Tk(). The GUI is displayed as fullscreen and the geometry is set to the 7” screen resolution. The text/label fonts are set to be used elsewhere in the program. The program has a cut out canvas frame placed inside the main window to display the grid of drink selection buttons.