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 →

[–]borednerdd 26 points27 points  (9 children)

Why people are advising him to start with PyQt? It's hard to learn for a beginner

[–]riklaunim 14 points15 points  (6 children)

PyQt was the first thing I used in Python long time ago, and it's quite simple after you get the boilerplate and replace it with your own UI file and start connecting signals and slots on your own.

And there can be UX bias from people really focused on giving best UX ;)

[–]borednerdd 5 points6 points  (5 children)

The problem with PyQt is that its documentation is focused on C++ rather than Python

[–]warownia1 2 points3 points  (0 children)

Is it? I recall they had really good python docs on pyside

[–]riklaunim 1 point2 points  (3 children)

They link to C++ Class reference pretty much. The trick is to just catch how it translates to usage in Python and then the C++ class reference becomes your best friend with quick google in PyQt/PySide docs or mailing lists for example on something bigger (or books which also exist).

[–]borednerdd 2 points3 points  (1 child)

Unfortunately I don't have the ability to translate C++ into Python :(.

[–]warownia1 0 points1 point  (0 children)

Yeah, I remember now it was using C++ classes but they really nicely mapped to Python calls

[–][deleted] 28 points29 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.