While Python is generally thought of as more of a sequential language that is called from the command line, several frameworks exist that allow you to construct your own graphical user interface (GUI). This can be extremely helpful if you intend to make your own dashboard, build a Nest thermostat clone, control lights in your office, or display sampled data in an easy-to-read format. In the following tutorial, we give you an introduction to the Tkinter package that comes bundled with most Python installations:
Python GUI Guide: Introduction to Tkinter
August 13, 2018
While other Python GUI frameworks exist, like wxPython, PyQt and Kivy, Tkinter is easy to learn, comes with Python and shares the same open source license as Python. We recommend starting with Tkinter as a place to learn about GUI development (or for quickly prototyping your own dashboard!) and then moving on to another package if you feel you need something prettier or more powerful.
In the tutorial, we give you an overview of the widgets available in Tkinter, followed by a relatively simple example of a temperature converter application.
We then show how to read and control hardware using the RPi.GPIO package. This culminates in a final example where Tkinter is combined with Matplotlib to create a live dashboard that automatically updates with real-time temperature and light data.
If you have done any GUI development, can you offer any tips to people just starting out? What’s your favorite GUI framework?