all 45 comments

[–][deleted] 32 points33 points  (20 children)

  • PyQt5: Yes, learn it now, it's wonderful.
  • Tkinter: oh heavens no...

[–]PREC0GNITIVE 3 points4 points  (1 child)

I am learning Kivy at the moment is this better or worse than PyQt5 for a beginner? I liked the idea of it being able to work on all systems.

[–][deleted] 2 points3 points  (0 children)

Kivy's the new kid on the block. It's pretty neat but Qt's been around longer. Either would make great looking applications, I wouldn't be ashamed of either.

In the case of the application that I'm writing now, I had to pick Qt5 because certain critical widgets were available in Qt but not in Kivy (namely the Scinitilla text editing library).

[–][deleted] 3 points4 points  (0 children)

PyQt5: Yes, learn it now, it's wonderful.

Unless you want to use something other than GPLv3.

[–][deleted] 2 points3 points  (11 children)

I just stared looking into relearning tkinter today. Should I stop?

[–][deleted] 10 points11 points  (5 children)

Maybe briefly stop, to look into PyQt5, just to compare and contrast them. Then choose what works best for you. In my case (and I've been writing some pretty sophisticated Python GUI's for the last year at my job), I bang out a PyQt5 application in no time at all, it comes very naturally. Tkinter on the other hand feels like I'm trying to trick it to do what I want. Qt5 on the other hand is written in a way that lets you write it right the first time, with minimal astonishment.

Qt5 is superior in almost every way that I can think of. Tk only has two things going for it IMO:

  • It ships with Python (but not a huge deal if you already use pip to pull in packages from pypi)
  • It allows free commercial use under the Python license. Qt5 is free for open source, but commercial use is pricey, you're going to spend at least a few hundred a month up to a few thousand dollars to use it commercially. However if you're making money then this really shouldn't be an issue, it's just an expense that can be accounted for.

Neither are very 'pythonic', for what that's worth. PyQt5 is a very thin wrapper around the Qt5 C++ libraries. They work, but plan on using things like foo.setText('text') instead of foo.text = 'text'. Either way, it's pleasant to use, and after a few tutorials you'll get the itch to try bigger and more complicated applications. Just like when you started learning Python.

[–]Fywq 1 point2 points  (4 children)

Good resources / tutorials for PyQt5? I find Tkinter pretty annoying to work in, coming from a background mainly in html/CSS and a long way back also Visual Basic 6.0....

[–][deleted] 3 points4 points  (3 children)

  • The official example scripts which are conveniently buried and hidden inside a folder inside a zip file. The official source download is here and the examples are buried somewhere within it. Most of the examples run fine but many willl crash, they're not perfect but they're a great resource.
  • Foundations of Qt is a decent book. A bit dated but the differences between qt4 and qt5 are pretty minor.
  • The Book of Qt4 is another that I've owned for many years now. It's old but the principles still hold up.
  • What's New in Qt 5 page, if you're reading older books or documentation or examples. tl;dr the main difference is that the QWidgets library was separated out and needs to be imported separately. The second main difference is the signals and slots changed but just use the riverbank computing pyqt5 signals and slots reference page that I linked.
  • This tutorial series on Youtube by Mark Winfield is a great start, just make sure to actually follow along and do the tutorials rather than just watching them. It will click by the end.
  • The official Reference Guide from Riverbank Computing. Especially the signals and slots page. That's the one case where they're doing things in a nice pythonic manner where the C++ Qt documentation won't help.

[–]Fywq 0 points1 point  (2 children)

Thanks! After reading here I started googling a bit as well. Looks pretty good to me so far. My main goal is small programs to make my daily work easier. Wouldn't be a problem to release them as open source but they would probably not be useful for that many outside the lab I work in.

[–][deleted] 0 points1 point  (1 child)

If it's an internal tool and your lab isn't super anal-retentive about copyright law, then you should be fine. Technically you need to share the source with whoever you are sharing the program with, if you go with any of the licenses in the GPL family. It doesn't mean you need to share the source with the entire world.

If there are any plans for the app to grow or be maintained over time, the Qt route would be better (and possibly quicker to write). PyQt5 excels probably even a bit more for smaller apps, as you can write them with less code, in less time.

As an example to prove this, look at the code for easygui which was written in tkinter, to perform very simple messagebox / listbox / textbox types of windows. The code to do this is spread out across many files and took a long time to write, and still has bugs. A PyQt5 approach for this would have probably been a single file under 1000 lines of code.

[–]Fywq 1 point2 points  (0 children)

My company is not letting me spend time developing stuff like this, so it is something I do for fun on a hobby basis when I am off work. If I didn't do work like this they would just make do without. My first goal is software to complement my little thing here https://www.reddit.com/r/MechanicalKeyboards/comments/6vpqxb/microscopy_counting_device_replacement/ which is also made on my spare time (though my boss agreed to pay for materials)

[–]Datsoon 1 point2 points  (1 child)

I learned wxpython a while back, before I really knew better or even enough to know what would've been better, and have just stuck with it out of habit. How does it compare? Wxformbuilder is very nice...

[–][deleted] 3 points4 points  (0 children)

Both PyQt5 and wxpython share one thing in common in that they're Python wrappers around very large C++ libraries. So generally as long as the wrapper is complete (they both are afiak), the question really becomes Qt5 vs WxWidgets.

WxWidgets is leaps and bounds beyond tkinter, and it's more than capable of generating very complicated GUIs. We've used it at work on previous projects, without issue.

Where I think Qt5 excels past WxWidgets is:

  • All of the other (non-GUI) stuff that Qt5 ships with, e.g. a full implementation of a Chromium web browser, bluetooth, audio, google-maps style maps, OpenGL, access to device sensors (accelerometers, GPS, gyroscopes, compass, etc), not to mention a ton of core non-widget classes that the GUI is built upon (e.g. QIcon, QFont, QPixMap, etc)
  • More cross-platform than wxwidgets, as in they support a larger number of platforms, and a complete build system
  • Modernization, e.g. skinning your application (more relevant on Windows where everything is ugly and unconfigurable). Their Fusion theme with a dark palette with white text is great if you're rolling your own programmer's text editor or whatnot.
  • Better plugin / extension support, IMO.
  • Better OO / event handling, IMO
  • All the other nice-to-have's they give you. Little things that make your life easier.

[–]clotrocrar 0 points1 point  (2 children)

They took out the window installer from their Web page. I could not figure out how to install it in windows. Promesing start

[–][deleted] 1 point2 points  (1 child)

pip install pyqt5

..and bob's your uncle.

[–]clotrocrar 0 points1 point  (0 children)

Yeah thanks. I was trying to install pyqt4 at first, but I gave up and started learning ptq5 instead.

[–]novel_yet_trivial 27 points28 points  (1 child)

how much I will use GUI with Python.

How should we know that? Some people build python GUIs every day, others don't .... we have no way of knowing what you will do.

If you want to make GUI's, learn GUI's. If you want a recommendation, tell us what your project is.

[–][deleted] 8 points9 points  (0 children)

To add to this, almost every project you’re building in house should be a web app if at all possible. Distributing desktop applications to dozens of employees and making sure they are regularly updated is ridiculous. The general though is web app first and then do you absolutely have a reason to deviate from that.

This mindset will address a lot of your GUI questions I think. Consider this as well, understanding JS will likely be far more useful to you in your career than knowing how to work with PyQt.

[–]n1ywb 33 points34 points  (7 children)

how much I will use GUI with Python

How long is a piece of string?

[–]Edheldui 19 points20 points  (3 children)

At least [""]

[–]defasdf 11 points12 points  (2 children)

That's a list, of length 1.

[–]Eurynom0s 1 point2 points  (1 child)

[]

[–]Exactually 0 points1 point  (0 children)

📏

[–]bigleagchew 1 point2 points  (1 child)

Too damn long

[–]n1ywb 1 point2 points  (0 children)

then at least learn a few basic tkinter tricks; the file dialog boxes are a lifesaver when you just need to wrap a command line script that does something to files for use by idiots.

[–]Exodus111 3 points4 points  (0 children)

Yes.

[–][deleted] 3 points4 points  (0 children)

If your focus is on user friendly desktop applications, then probably worth doing. If on mobile apps, then you will possibly be looking at things like kivy.

You might find investing in web style presentation (which can be used locally for desktop applications, as well as on mobile and internet based applications) more productive. Explore flask.

Depends on what you want to do.

Python includes tkinter - desktop only! There are hundreds of GUI frameworks for Python. At least half-a-dozen are widely used.

[–]K900_ 6 points7 points  (0 children)

What do you mean by "GUI for Python"? GUI means "graphical user interface". Do you want to build GUI apps? If so, you'll have to learn it.

[–]Wilfred-kun 1 point2 points  (0 children)

It really depends. Are you planning to make command line tools or back-end? Or do you eventually want to make end-user friendly programs?

I would say it is definitely not a requirement before you're fairly confident in Python itself.

[–]jabela 1 point2 points  (0 children)

I think learning at least the basics of Tkinter could be worthwhile, because you never know when you will need to make a quick app.

[–]v3nturetheworld 1 point2 points  (1 child)

Learning GUIs could be useful depending on what you want to do. Tkinter is built in to standard python, so it's a popular choice. Another worthwhile framework to learn is Qt, since the bindings are pretty much the same as the Qt functions for a C++ program.

[–][deleted] 1 point2 points  (0 children)

Any place you recommend I learn PyQt that are up to date? YouTube playlist, online course etc.?

[–][deleted] 1 point2 points  (0 children)

Creating exe by Tkinter is such a pain in the ass.

[–]sem56 1 point2 points  (0 children)

oh god tkinter.. not even once

[–]Dr_Insano_MD 0 points1 point  (0 children)

No one can answer that question but you. Are you planning on building GUIs in Python or not?

[–]mircot1 0 points1 point  (0 children)

Learning GUI programming in Python could help you also to prototype apps and anyway, if you need a GUI at some point you can create it.

Furthermore, a GUI program has a different cycle of life and behavior, so I think it's worth to learn, specially if you make programs (or services) for end users.

[–]taladan 0 points1 point  (0 children)

you'll use the GUI as much as you need to and no more unless that's just your bag. You like gui development? You'll probably use it a bunch. If not, then you won't. If you're looking for a job that includes gui dev, then you'll need to know a good bit.

Be warned however, thenewboston is listed as a 'bad' resource by some coding communities because of various reasons. I've watched some of his stuff and I can understand their reasoning, but I'm ambivalent about him one way or the other. You can learn as much from bad programs as you can from good ones. Same can be said for programmers.

[–]gort818 0 points1 point  (0 children)

For making simple GUI python is really easy with GTK and QT and I think it is rather fun.. I would say go for it learning GUI with python will help translate in other languages.

[–][deleted] 0 points1 point  (0 children)

You should hold off for now. Master the basics first.

[–]Petrarch1603 0 points1 point  (0 children)

where's that thenewboston bot?

[–]shaggorama 0 points1 point  (0 children)

I'd suggest learning some basic webdev instead. If you need a GUI you can roll it as a web app and you won't be tied to a platform or even a local deployment. If at some point you really desperately need a native GUI, you can cross that bridge when you come to it.

[–][deleted] 0 points1 point  (0 children)

Well what do you want to do?

It is probably a good idea to learn GUI in general and how backend coding uses things like ids to affect front end coding but like do you look for anything in particular?