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"] leafpad = ["Leafpad","leafpad"] scratch = ["Scratch","scratch"] pistore = ["Pi Store","pistore"] app_list = [leafpad,scratch,pistore] APP_NAME = 0 APP_CMD = 1 class runApplictionThread(threading.Thread): def __init__(self,app_cmd): ...