Raspberry Pi 3 Cookbook for Python Programmers - Third Edition
by Steven Lawrence Fernandes, Tim Cox
How it works...
We create the Tkinter window as we did before; however, instead of defining all the items separately, we create a special class for the application buttons.
The class we create acts as a blueprint or specification of what we want the appButtons items to include. Each item will consist of a string value for app_cmd, a function called startApp(), and an __init__() function. The __init__() function is a special function (called a constructor) that is called when we create an appButtons item; it will allow us to create any setup that is required.
In this case, the __init__() function allows us to create a new Tkinter button with the text to be set to an item in app_list and the command to be called in the startApp() function when ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access