How to Build User Interfaces with Python — PyQt Basics
Are you tired of all the programs you create running in the console? Try graphical interfaces! It’s very easy to do in Python.
Not a Medium subscriber? Read for free here!
PyQt or Tkinter?
PyQt and Tkinter are the two main libraries you can use to build user interfaces with Python. Neither is better than the other, but depending on what you want to achieve one or the other may be more suitable
Tkinter:
- Simple and light. This allows you to quickly and easily set up a graphical application.
- Fewer possibilities than PyQt.
- GUIs are difficult to customize.
- Works with events to manage interactions.
PyQt:
- Complex and heavy. The learning curve isn’t the same as the one of Tkinter but once you master PyQt you can build everything.
- GUIs are easily customizable using style sheets (CSS).
- Works with a system of signals and slots which can be a bit confusing for beginners.
It’s good to know both libraries, eventually to know how to use them both, and to decide which one to use depending on the project. Tkinter will be useful for small projects, that…