Python GUI, PyQt vs TKinter
Tags: python
Published: 2019-10-31 12:12:06

---
title: Python GUI, PyQt vs TKinter
category: python, pyqt, tkinter
cover_image: https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.familiesonline.co.uk%2Fimages%2Fdefault-source%2Fnational%2Fcarmarthenshirelist1-llanarthne-fireworks-lo16.jpg%3Fsfvrsn%3Da4d2e49e_0&f=1&nofb=1
published: true
---
Both <a href="https://en.wikipedia.org/wiki/Tkinter">Tkinter</a> and <a href="https://riverbankcomputing.com/software/pyqt/intro/">PyQt</a> are useful for designing acceptable GUI’s, but at the same time, they differ in terms of adaptability and functionality. 

Mostly, Tkinter is all about writing GUI yourself, program your settings or functionality in the same script. 

On the other hand, in PyQt, you separate GUI in a script, and use your Python knowledge from another script. 

Instead of creating your own code for the user interface, *you can simply adopt the <a href="https://pythonbasics.org/qt-designer-python/">Qt Designer</a> functions to develop your application*. 

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fpythonbasics.org%2Fwp-content%2Fuploads%2F2019%2F01%2Fqtdesigner.png&f=1&nofb=1">

Therefore, let’s see what the main differences and advantages of PyQt vs. Tkinter are.
 
## PyQt 

### Advantages of using PyQt

1.	Coding flexibility – GUI programming with Qt is designed around the concept of <a href="https://pythonspot.com/pyqt5-signals-and-slots/">signals and slots</a> for establishing communication amongst objects. That permits flexibility when dealing with GUI events and results in a smoother codebase.
2.	More than a framework – Qt uses a wide array of native platform APIs for the purpose of *networking, database creation, and many more*. It offers primary access to them via a unique API.
3.	Various UI components – Qt offers several widgets, such as <a href="https://pythonpyqt.com/pyqt-button/">buttons</a> or <a href="https://pythonprogramminglanguage.com/pyqt-menu/">menus</a>, all designed with a basic appearance across all supported platforms.
4.	Various learning resources – because PyQt is one of the most used UI frameworks for Python, you can get easy access to a wide array of documentation.

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fbuild-system.fman.io%2Fstatic%2Fpublic%2Fimg%2Fpyqt5-example-app.png&f=1&nofb=1">

5.	Easy to master – PyQt comes with a user-friendly, straightforward API functionality, along with specific classes linked to Qt C++. This allows the user to use previous knowledge from either Qt or C++, making PyQt easy to understand.
 
### Disadvantages of using PyQt

1.	Lack of Python-specific documentation for classes in PyQt5
2.	It requires a lot of time for understanding all the details of PyQt, meaning it is a quite steep learning curve
 
## Tkinter

### Advantages of using Tkinter

1.	Available out-of-charge for commercial usage.
2.	It is featured in the underlying Python library.
3.	Creating executables for Tkinter apps is more accessible since Tkinter is included in Python, and, as a consequence, it comes with no other dependencies.
4.	Simple to understand and master, as Tkinter is a limited library with a simple API, being the primary choice for creating fast GUIs for Python scripts.
 
### Disadvantages of using Tkinter

1.	Tkinter does not include advanced widgets.
2.	It has no similar tool as Qt Designer for Tkinter.
3.      It doesn't have a native look and feel

<img src="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.ucolick.org%2F~de%2FTcl%2FTcl2K%2Fcontest.gif&f=1&nofb=1" alt="tkinter look and feel"> 
 
## What to choose?

Anyhow, in most situations, the best solution is using PyQt, considering the advantages and disadvantages of both PyQt and Tkinter. 

GUI programming with Qt is created around signals and slots for communication amongst objects. Thus, it allows flexibility, while it gets to the programmer access to a wide array of tools. 

Tkinter can indeed be useful for those that want to design a fundamental and rapid GUIs for Python scripts, yet *for a more advanced programming result*, almost all programmers opt for the functionalities that come with *PyQt*. 

They admit it is worth mastering the advanced knowledge of PyQt due to the professional programming results that come along. 

Thus, when it comes to PyQt vs. Tkinter, it all depends on how much you want to learn and discover. 

**Resources:**

* <a href="https://gum.co/pysqtsamples">Course: PyQt dekstop apps</a>
* <a href="https://pythonbasics.org/pyqt-hello-world/">PyQt hello world</A>
* <a href="https://pythonbasics.org/tkinter/">Tkinter tutorial</a>