Python GUI

There are different possibilities to create a Graphical user interface (GUI) using Python, e.g, Guizero, EasyGUI, pyqt6 and Tkinter

0) Guizero. More Guizero examples here

from guizero import App, Text, Picture
app = App("Test") = "#FBFBD0"
test_text = Text(app, "TEST")
test_text.text_size = 50
test_text.font = "Times New Roman"
myimage = Picture(app, image="myimage.png")

1) Tkinter installation
The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit.
Both Tk and tkinter are available on most Unix platforms, as well as on Windows systems.
Tkinter is installed along with Python installation and no other setup is required. To check tkinter installation, run the following command in python command prompt shell.
python -m tkinter
This should open a window demonstrating a simple Tk interface and letting you know that
tkinter is properly installed on your system, and also showing what version of Tcl/Tk is in-stalled, so you can read the Tcl/Tk documentation specific to that version.

Testing Tkinter

>> import tkinter
>> from tkinter import *In the case, your tkinter is not installed, use the following command in python Prompt to install Tkinter.

for installation in pip and windows, run:

>> pip install tk

Once you’ve installed or compiled Python, test it out to make sure Tkinter works. From the Python prompt, enter these two commands:
>>> import tkinter
>>> tkinter._test()
This should pop up a small window; the first line at the top of the window should say “This is Tcl/Tk version 8.6”
You can also get the exact version of Tcl/Tk that is being used with:
>>> tkinter.Tcl().eval(‘info patchlevel’)
It should return something like ‘8.6.9’.

However, in Linux to use Tkinter, you need to install a separate package, named python3-tk:

> sudo apt-get install python3-tk

Tkinter has two generations of widgets:

The old classic tk widgets from 1991 and the newer themed ttk widgets added in 2007 with Tk 8.5. The newer Tk themed widgets replace many (but not all) classic widgets.

Note that ttk stands for Tk themed. Therefore, Tk themed widgets are the same as ttk widgets

The tkinter.ttk module contains all the new ttk widgets. It’s a good practice to always use themed widgets whenever they’re available.

The following statements import the classic and the new Tk themed widgets:

import tkinter as tk

from tkinter import ttk

root = tk.Tk()

tk.Label(root, text=’Classic Label’).pack()

ttk.Label(root, text=’Themed Label’).pack()


They look similar. However, their appearances depend on the platform on which the program runs.


The tk_tools package has a collection of widgets and tools for efficient and easy creation of GUI elements. These can be classified into three types of widgets: groups of widgets that are useful as a group, visual aids using the canvas and useful improvements on existing widgets,

for installation in pip and windows, run:

>> pip install tk-tools


>> import tk_tools


This module is useful in accessing the serial port using Python programming. The module named “serial” takes care of the necessary process involved

for installation in pip and windows, run:

>> pip install pyserial

>>import serial


This module contains a ColorPicker class which implements the color picker and an askcolor function that displays the color picker and returns the chosen color in rgb and html formats.

for installation in pip and windows, run:

>> pip install tkcolorpicker


>> from tkcolorpicker import askcolor


pyFirmata is a Python interface for the Firmata protocol. pyFirmata is a useful package for working with arduino microcontrollers with direct access to input and output pins of Arduino. There is no need to program your Arduino every time. This gives flexibility and reuse of hardware for multiple projects without reprogramming it.

for installation in pip and windows, run:

>> pip install pyfirmata


>> from pyfirmata import Arduino, util

2) Tkinter window creation

3) Tkinter widget: button

4) Label

5) Entry

6) Check and radio buttons

Just substitute Check by Radio

7) List box

8) Frame

9) Canvas

10) Menu buttons

11) Message box

12) Scale (slider)

13) Scroll bar

14) Text

15) Spin box

16) Message box / alert

17) Adding images

18) Event calls and functions

19) LEDs and Arduino

20) Seven segments display

21) Rotary scale

22) Smart options menu

23) Other widgets to try

24) GUI LED Arduino

25) Servo control

26) Servo control

27) Ultrasound sensor