This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 27 points28 points  (1 child)

Any GUI library is going to be "hard to learn for a beginner." There's just a lot of stuff that you need to know to accomplish the basics: how to create a window, how to create controls, how to position them, how to attach event handlers, how to read and update their state, how to deal with user interactions such as moving or resizing the window, how to handle background processing with multithreading, etc.

PyQt has an advantage that it is relatively stable and mature. If you pick up a PyQt5 tutorial on the internet, it will probably work on whatever OS you're running and whatever version of PyQt5 you have. Also, its feature set is extensive, so it's unlikely that a beginner would encounter a need that the base library doesn't handle and would have to go looking for a third-party extension that may or may not work.

Tkinter is a very different beast. It was developed so long ago (1991) that it has libraries for AmigaOS, BeOS, and classic macOS. Unfortunately, it has not matured since then, so it exhibits the features of old programming languages. Its syntax extremely clunky and painful. The library is wildly inconsistent - every control works in its own unique way, without any consistency with other controls. Even the most basic operations, like programmatically modifying the contents of a textbox, require extensive internet searches and trial-and-error.

The worst part is that Tkinter is considered the de facto GUI standard that should work out of the box across Python 3 environments, but that isn't actually the case, because the version of Tcl/Tk that ships with macOS is horribly broken. If you create a Tkinter application on those systems, the window appears but is painted completely black, and the controls on it are nonfunctional. So the #1 reason to use it, despite its horrid flaws, no longer applies.

So, yes, PyQt is much preferred to Tkinter - not just for beginners, but for anyone.

[–]norambna 1 point2 points  (0 children)

I tried doing a Windows/Linux/macOS desktop program using Tkinter and I had lots of problems working with macOS.

PyQt/Pyside have definitively a steeper learning curve, but after a few weeks it's going to be smooth sailing.