In the past few decades, computers have relied on interaction with the user via a graphical user interface, i.e., a GUI. It consists of a main window, a menu, a toolbar, buttons, labels, etc. There are various Python tools for building GUIs, and here I will go through seven of them. The general structure of these tools is similar – one has to define the main window, together with some components inside it.
Indice dei contenuti
Use DelphiVCL to produce great Windows GUI apps with Python
The Python4Delphi (P4D) package provides a connection between Delphi’s VCL (Visual Component Library) and Python. DelphiVCL can be used to build Windows GUI applications. It supports Win32 and Win64 x86 architectures. The package can be used from an IDE such as PyScripter or the command line. Extensive tutorials are available on YouTube, and an introduction is provided here. It can be installed as
pip install delphivcl
DelphiFMX allows you to create cross-platform Python GUI apps
Delphi’s FireMonkey framework is also based on the Python for Delphi (P4D) library. DelphiFMX is a cross-platform Python package for building GUIs for Windows, macOS, Linux and Android available from pip. It is hardware-accelerated with a GPU via DirectX or OpenGL, which is essential for modern software. The package is easy to use and features a wide variety of components, including menus, panels, lists, buttons and many more. There are examples available in the official repository on GitHub.
Tkinter is a solid Python tool for GUIs
Tkinter is a Python interface to the Tcl/Tk GUI toolkit. It is an object-oriented layer on top of Tcl/Tk and typically comes by default with Python installations. The package is available on Linux, macOS and Windows. It comes with various widgets to construct the content. The package has been around for many years, and there are many examples online.
PyQt lets you use Qt app framework with Python
PyQt binds the Qt application framework with Python. The present version, PyQt5, is available as a pip package. It is also cross-platform and contains a variety of modules and its own IDE for development, though one can use their favorite development environment.
You can use WxPython for Python GUI apps
Among the earliest Python tools for GUI development is WxPython, initially released in 1998. Actually, the pip package is a wrapper around code written in C++. It is cross-platform, however, I had a problem installing it for Python 3.8 over Conda.
Python GTK+ 3 brings the GNOME UI to your Python apps
Python GTK+ 3 is more complicated to install. It can be built from source with JHBuild, originally a GNOME building tool. It requires the PyGObject module which is a wrapper to access the GObject system used by various libraries, including GTK. That aside, the code structure is similar to the other Python tools.
Kivy is a Python tool for C-style GUIs
Kivy is among the tools aiming at mobile devices, as well, and includes multitouch and pen support. GUIs can be built for Windows, Mac, Android, iOS and Raspberry Pi with OpenGL acceleration. It is written in C with Cython binding. I found that it was impossible to run the example code from the Windows subsystem for Linux even though usually Xming handles graphical programs without any issues.
Building GUIs does not need to be an impossible chore. There are various Python tools available as pip packages. I was impressed by DelphiFMX with its customizability and wide variety of features. Go ahead and try it today. For the Windows-only developers, I highly recommend DelphiVLC because of its native support for hardware acceleration.