Creating a graphical application – Start menu

The example in this recipe shows how we can define our own variations of the Tkinter objects to generate custom controls and dynamically construct a menu with them. We will also take a quick look at using threads to allow other tasks to continue to function while a particular task is being executed.

Getting ready

To view the GUI display, you will need a monitor displaying the Raspberry Pi desktop, or need to be connected to another computer running the X server.

How to do it…

To create a graphical Start menu application, create the following graphicmenu.py script:

#!/usr/bin/python3 # graphicmenu.py import tkinter as tk from subprocess import call import threading #Define applications ["Display name","command"] ...

Get Raspberry Pi for Python Programmers Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.