DEV Community

Cover image for Python GUI, PyQt or tkinter?
jones268
jones268

Posted on

Python GUI, PyQt or tkinter?

You can make a GUI with Python using the modules tkinter or PyQt. Wanna make a GUI application in Python 3?

You have to choose between the Tkinter and PyQt libraries.

I have been using Tkinter for some time now (as in 15 Years) and am familiar with it. In our current project we have started to use PyQt classes and I find them more intuitive.

Tkinter is a bit more verbose, Qt more convenient. Tkinter used to be part of the standard python library which is installed on most systems

PyQt

pyqt is an object-oriented Python binding of the cross-platform Qt GUI toolkit.

PyQt provides full access to all Qt 5.x stable widgets.
It is simple, mostly API compatible and very efficient. Another goal of PyQt is to be a bridge between the huge
number of existing Qt applications and Python programmers.

Some of the major features are:

  • Python syntax in .py files, no need for .ui files;
  • A unique Pythonic interface: Python variables can be used as properties;
  • Powerful event system with multi-level undo/redo support;
  • Full integration with the Python interpreter (call Python from Qt applications; call Qt application from Python);
  • Access to all (nearly 400) non-deprecated functions and properties of the Qt 5.x API.
  • Cross-platform on computers and embedded devices
  • Supports many widgets, even a widget to play video

pyqt

tkinter

Python includes a graphical user interface (GUI) toolkit called Tkinter. Tkinter is based on the original Tcl/Tk package and provides a set of classes to create and control graphical user interfaces.

Tkinter is the Python interface to the Tcl/Tk GUI system.
It is a wrapper around Tcl/Tk that allows for rapid GUI development in Python.

It provides both a traditional (Tkinter) interface and more modern Scrolled Canvas, and other Tkinter-like widgets.
It was written to provide a simple, portable and capable interface for Python programs that need a windowing environment.

It has been tested on MS-Windows, X-Windows (Linux, Solaris, ...), MacOS, BeOS, AmigaOS, QNX, VMS and pSOS+.

Comparison

The number of widgets is very limited in tkinter compared to PyQt. On top of that, PyQt comes with a drag and drop designer program.

Tkinter also has quite an old-fashioned look, as compared to PyQt which can mimick a native OS look.

If you are new to PyQt, this course is a good place to start.

Top comments (3)

Collapse
 
iceorfiresite profile image
Ice or Fire

Have you checked out WxPython?

Collapse
 
jones268 profile image
jones268

Yes I did but I didn't get it working and got confused. There seems to be a new version, wxPython's Project Phoenix. The project wxPython seems abandoned github.com/wxWidgets/wxPython-Classic. Last commits several years ago

Collapse
 
williamlake profile image
William Lake

Pysimplegui is also a great choice, albeit the documentation is kind of a one page wall of text.