Hacker News new | past | comments | ask | show | jobs | submit login

FWIW I use PyQt5 in a code editor project I maintain. While all GUI frameworks have hiccups and smells to various degrees, Qt and PyQt5 has been, relatively speaking, the strongest UI framework I've encountered for Python. Why? Ease of development, cross-platform reach, "batteries included" (e.g. accessibility features, important for my project), friendliness of the API and breadth of features immediately spring to mind.

Perhaps PySide's return will encourage some competition in the Qt space for Python. For example, I wish it was simple to create a cross-platform installer for stand-alone Python apps that use Qt. Current solutions suffer from the 80/20 rule where the 20 usually contains something essential.




Sorry to be spamming here but check out my https://github.com/mherrmann/fbs. It is literally the solution to your pain point.


No, interesting and useful. But a few questions. So basically you have automated the job of calling PyInstaller to make a standalone app, plus the step of wrapping the app in an installer. Yes?

In order to use this, if I read the tutorial[1] code correctly, I must modify my app to wrap everything -- or at any rate, all PyQt-related things? -- inside an AppContext, and modify the outermost level to create this.

If so, this is easy enough for the tutorial but what if my app opens multiple windows and has code to create them spread over multiple modules (as one of mine does). Is there a simple way to get all these bits into one "context"? Or have I read too hastily?

[1] https://github.com/mherrmann/fbs-tutorial


It's more than just automating the calling of PyInstaller. It also fixes some edge cases with PyInstaller-built apps that lead to crashes on some users' systems and took me months to figure out. Further, it integrates the solutions nicely. You don't have to learn how PyInstaller works, fbs does it for you with very reasonable default settings. You don't have to figure out how you are going to ship resource files and access them from within your app, etc.

Yes you should use the AppContext. You don't have to convert your entire app to it. Only enough to "start" your app. (I highly recommend the app context approach where possible however, it's just so clear.)


Man, when a project is this useful, spam away. Thanks for this.


Does it use Qt IFW? That's what I've been using for cross-platform installers.


Aha... thanks for the heads-up. :-)


I'll echo this.

I've maintained a production PyQt based app for 7-8 years (started on PyQt4/py2, moved to PyQt5/py3, but I evaluated PySide as well). It involved wrapping another Qt library for use from python. I found the bindings I created based on SIP (which is what PyQt is based on, both written by the same author) to be overall easier to create and smaller in size.

It's great that we're getting Qt backed bindings but Phil Thompson has done a wonderful job with PyQt over the years and I really would've liked to see it become the official library somehow.


Has the python qt installation story improved much recently? A few years ago it was a pain to set up, especially within a virtualenv, which was one of my only complaints with it. Everything else was wonderful.


You can just do `pip install PyQt5` now. That is possible without a virtual environment, but in practice I think you still want to use one: python3 -m venv venv && source venv/bin/activate && pip install PyQt5.


How well does that work on OSX? I’ve tried many times over many years, but never got a satisfactory working Python + Qt development environment working on the Mac.


With Python3 and PyQt5 it is literally as simple as "pip install pyqt5". I speak from having built and maintained multiple PyQt-based apps on MacOS.

Edit: I should say, there are MacOS-unique difficulties if you want to bundle your nice PyQt5 script into a standalone MacOS app bundle using PyInstaller. But that's a separate issue.


conda install pyqt


Why was this downvoted?

It will setup exactly what was asked for. Specifically qt 5.9.5 with PyQt.


>>> You can just do `pip install PyQt5` now.

>> How well does that work on OSX?

> conda install pyqt

Your comment, while presenting a potential solution to the original problem, did not make sense in context and went off in another direction entirely.


Did you miss that I was replying to simonh, and to be specific, to this part?

> I’ve tried many times over many years, but never got a satisfactory working Python + Qt development environment working on the Mac.


pip installing binary dependencies! What could go wrong?


With the new binary wheels, this actually works now - at least on Windows 10 and misc Linux distros (and according to other comments here, on Mac OS too).

On Linux you might want to get the distros qt/qt-dev packages, as usual. But as far as I can recall, you generally don't have to.


Great - installing random (huge) binaries that have been compiled god-knows-how by god-knows-whom expecting god-knows-what other libraries to be on the target system.


What could go wrong?


Mix of dynamic libraries, missing libraries, mismatch between libc versions. Requirements for a c compiler to be available.

But all of these things have improved greatly, in my recent experience.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: