Skip to content

Instantly share code, notes, and snippets.

@novaTopFlex
Last active April 25, 2024 17:56
Show Gist options
  • Save novaTopFlex/392463602c9eca2085caa1ae1e8d9068 to your computer and use it in GitHub Desktop.
Save novaTopFlex/392463602c9eca2085caa1ae1e8d9068 to your computer and use it in GitHub Desktop.
Graphical User Interface (GUI) Modules for Python

Recommended Modules

Tkinter (default module)

Name of module in Python 2.x:

Tkinter

Name of module in Python 3.x:

tkinter

Description

The "standard" graphical user interface "GUI" library for the Python programming language and various interpretations. Compatible with nearly all Python 2.x and 3.x interpreters, this Python module should operate successfully on Windows (NT-based) and UNIX-based systems, including Apple macOS as well as the various open-source distributions of Linux/BSD/Solaris that are also based on UNIX.

wxPython

Name of module in Python 3.x:

wx

Description

This is an alternative and more fully-featured module for creating graphical user interfaces with Python 3.x versions. Nearly all recent Python 3.x interpreters should operate with success, and a vast array of classes is provided for a more diverse feature set, or at least for the perception thereof. While there is in fact a significantly larger number of possible classes for graphical elements, much of the difference is often based on slight differences between classes that may not function particularly differently in end-user operation.

Compatibility

While wxPython is primarily intended for applications targeting Microsoft Windows, thus the design of various elements, much of the interface should still operate on Apple macOS and other UNIX-based systems (Linux/BSD/Solaris distributions).

PySide

Name of module in Python 2.x, 3.x:

PySide

Deprecation Warning

This module should no longer be used in new Python projects. The module was specifically designed for interfacing with the Qt 4 libraries that are no longer supported or widely in use. Legacy versions of various Linux/BSD/Solaris distributions "distros" may continue to demand this library for Qt 4 versions of certain graphical applications, particularly on graphical distributions of years between 2005 and 2011/2012. The Qt 4 libraries have officially been unsupported, however, since 2015. For new applications, please use the PySide2 or PySide6 modules for similar functionality.

Compatibility

The PySide module is intended for Python 2.6.x, 2.7.x, 3.2.x, 3.3.x, and 3.4.x versions. Each of these listed versions had been released (with x = 0) between the years 2008 and 2014, so this module is generally not recommended on more modern UNIX-based distributions "distros" (Linux/BSD/Solaris).

PySide2

Name of module in Python 3.x

PySide2

Description

This graphical user interface (GUI) module intends to port elements of Qt 5 to Python interpretation. This module enables the creation of graphical user interfaces using Qt 5.x versions.

Compatibility

The PySide2 module is intended for Python 2.7.x, 3.5.x, 3.6.x, 3.7.x, 3.8.x, 3.9.x, and 3.10.x versions. Starting with the Python 3.11.x series, this is now a deprecated module.

PySide6

Name of module in Python 3.x

PySide6

Description

While the number may be out-of-sequence as PySide2 is the immediate predecessor to PySide6, the latter module is designed for Qt 6, thus the number "6" to replace the old versioning system. Much of the syntax, however, should remain nearly identical to the syntax of PySide interpretation.

Compatibility

The PySide6 module is intended for Python 3.9.x, 3.10.x, 3.11.x, and 3.12.x versions. The Python 3.13.x series is currently in alpha development and is thus not guaranteed compatibility with this module.

PyQt5

Name of module in Python 3.x

PyQt5

This module to port Qt 5 to Python interpretation is the standard module for creating Qt 5 applications with Python. Although the PySide series of modules is based on the PyQt series of modules, the primary difference between these closely-related libraries is in form of licensing. While the PySide series is licensed primarily under the GNU Lesser General Public License with some GPL components, the PyQt series is licensed entirely under the GNU General Public License prohibiting the implementation of the module in proprietary software applications.

Compatibility

As a module, PyQt5 intends to be compatible with all Python 3.x versions beginning with Python 3.7.

PyQt6

Name of module in Python 3.x

PyQt6

This module to port Qt 6 to Python interpretation is the standard module for creating Qt 6 applications with Python. Although the PySide series of modules is based on the PyQt series of modules, the primary difference between these closely-related libraries is in form of licensing. While the PySide series is licensed primarily under the GNU Lesser General Public License with some GPL components, the PyQt series is licensed entirely under the GNU General Public License prohibiting the implementation of the module in proprietary software applications.

Compatibility

While the PyQt6 module is intended to interface with Qt 6, the module actually supports an older version of the Python interpreter that is officially unsupported with PyQt5; that would be the Python 3.6.x series beginning with Python 3.7. Otherwise, this module continues to support Python versions

PyGObject

Modules in Python 3.x

Although the PyGObject installation does not come packaged with a module of an identical name, two (2) imported module names exist, neither of which seem quite obvious at first glance. However, the two module names are ultimately gi and pygtkcompat, and both must be spelled in all-lowercase letters (no caps).

Description

This two-module package is intended to port a Gtk (formerly Gtk+ until 2019) interface to the Python programming language and interpreter. While the pygtkcompat module is more of a reference module, the gi module is the primary module for Python applications developed with the Gtk toolkit.

Dual Compatibility

Depending on the parameters being passed to the gi.require_version() function, this module could serve compatibility for either Gtk 3.0 or Gtk 4.0 graphic design. The functions available within the gi.repository.Gtk module, which must not be imported until after the arguments passed to the gi.require_version() function, may dramatically vary between the Gtk 3.0 and Gtk 4.0 setups despite descending from what is otherwise identical modules (as gi).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment