Live data from Hacker News

Hello Qt for Python

blog.qt.io

81–90 of 176 posts

Re: Hello Qt for Python

#81
post #19
post #6

What happened to PyQt? Also, the API does not seem Pythonic at all.

I think PyQt is owned by a different company, so Nothing happened to it, I guess. PySide is waaaay more Pythonic than PyQt ever was. Types are actually translated to Python native types and APIs are way more Pythonic and not just translated 1:1 like PyQt.

In the visual effects industry, it's common practice to write GUIs using Python and Qt that are compatible with PySide, PySide, PyQt4 and PyQt5 all at once. I think that speaks for how similar these bindings really are. Source: I maintain the most widely used shim for such occasions https://github.com/mottosso/Qt.py

Re: Hello Qt for Python

#82
post #66

Very happy to hear this as the author of a PyQt-based file manager [1] and an open source library for solving the many headaches that come with developing desktop apps [2]. Once Qt for Python is stable enough, I'll be happy to switch to it from PyQt. [1]: https://fman.io [2]: https://github.com/mherrmann/fbs

What would you recommend to someone who wants to write Python desktop applications today? I've used wxWindows way back when, and I'd hate to use Electron. Would you go with Qt for Python, or PyQT? Also, what's PySide/PySide2?

Wxwindows was a dream to work with. Electron needs to die a fiery death. preferably the corpse is then mauled by bears and tigers

Re: Hello Qt for Python

#83

Is is possible to use QML in a PyQt/PySide2 app? Using QML for interface and Python for logic would make perfect sense. But every PyQt article and tutorial I see is about QtWidgets.

Yes, PyQt4/5 has supported this since it was first introduced, PySide2 just recently got some support for it although it is incomplete. Source: I maintain a Python/QML library https://github.com/pyblish/pyblish-qml

Re: Hello Qt for Python

#84
post #65

Earlier quoted context omitted.

Sorry, I thought it was generally accepted that Python's relationship with the GUI was troubled? Put in plain English it is like this. I write quite a lot of code that integrates various enterprise systems together. Things like EDI management, and 'brokers' between incompatible API's. It is usually a mixture of Python/Bash/SQL. It is not my full-time job to code, but I get things done. As complexity increased I learn…

> My Python head says this should look like this No, that's not "your python head", sorry, that's your "VB head" at best. That's lack of knowledge of how desktop GUI paradigms actually work and what an event loop is and how it interacts with threads. I do not disagree that VB (and Delphi) did a better job at hiding these concepts from the "just getting it done" crowd, but don't blame it on Python if you don't have a…

> but don't blame it on Python if you don't have a grasp of how C++ GUI toolkits actually work.

I'm not blaming it on Python, honestly. I'm just really surprised that there isn't a framework that will hide that stuff from me like VB did. You are a 100% correct in that I don't know anything about desktop GUI paradigms, or C++ GUI toolkits. I really don't have the bandwidth to find out either! I'm also surprised that I need to. I don't think that is even my VB head, I am a business systems person who has successful modeled a physical process in software. In a recent case I did all of the work negotiating with vendors/management/users, I found the bugs in the vendors API, and I did this to an absurd deadline (with almost zero budget) created by a a vendor withdrawing a product with no notice. That's the kind of absurd thing us plebs in the "just getting it done" crowd have to do all of the time. But I am finding that simple GUI launchers for my software are really complicated in Python with the frameworks I have found. I am shocked that this is the piece that is defeating me! As I said before, I could write a web front-end for this kind of thing relatively easily (in the above case it was a hardware requirement that lead me to try again at the desktop GUI). Perhaps this is why we see so many people looking at the web-app-on-the-desktop that is so derided on these pages?

Re: Hello Qt for Python

#85
post #71

Earlier quoted context omitted.

The Python standard library itself also breaks the PEP8 naming convention in all the ways PyQt does so their decision really makes sense. If Python itself were consistent the trade-off would be different... I find PyQt to be Pythonic in all the ways that count, e.g. replacing `self.setFoo(bar)` with `self.foo = bar`, decorators for signals/slots, etc.

It does? Which library?

Unfortunately, a few library modules that predate PEP 8 and that never made the switch still use camel case, such as `unittest` and a few others. Bugs the hell out of me, as do libraries that have no excuse for their lack of compliance with PEP 8, such as PySide.

Re: Hello Qt for Python

#86
post #14

I would love to hear more about this from the sages of HN. I really don't enjoy GUI development in Python. I am not a good enough CS to have the language to describe what is wrong, but I find it really hard to get Python GUI stuff to do what I want.

Retained-mode GUIs like Qt , wxWidgets, gtk, etc aren't intuitive. Try an immediate mode GUI, like my python bindings to nuklear https://github.com/billsix/pyNuklear

Another option is pyImgui. Imgui is C++ based. pyimgui isn't on the latest imgui version, but it's coming along. https://github.com/swistakm/pyimgui

Re: Hello Qt for Python

#87
post #67

I have been waiting for this my entire adult life. That's all I have to say about it.

What about pygobject? What does Qt have to offer over GTK?

I like pygobject too, but I've always wanted a QT library for python not written by a 3rd party. Most of the 3rd party libs will get you 90% there, but if QT commits to making the library, they won't leave me hanging. I've been wanting to build a python desktop app with the newest version of QT with lots of dynamic UI windows for a very long time, and this will allow me to do it.

Re: Hello Qt for Python

#88

Is is possible to use QML in a PyQt/PySide2 app? Using QML for interface and Python for logic would make perfect sense. But every PyQt article and tutorial I see is about QtWidgets.

We use PyOtherSide for exactly this. Works perfectly.

I'm also working on a similar solution for .NET Core: https://github.com/pauldotknopf/net-core-qml

Re: Hello Qt for Python

#89
post #66

Very happy to hear this as the author of a PyQt-based file manager [1] and an open source library for solving the many headaches that come with developing desktop apps [2]. Once Qt for Python is stable enough, I'll be happy to switch to it from PyQt. [1]: https://fman.io [2]: https://github.com/mherrmann/fbs

What would you recommend to someone who wants to write Python desktop applications today? I've used wxWindows way back when, and I'd hate to use Electron. Would you go with Qt for Python, or PyQT? Also, what's PySide/PySide2?

As you can see, Qt for Python is not yet stable release. So you will want to use PyQt5 first. I remcommand PyQt5 because there are more resouces available on the internet now.

PyQt5 and Qt for Python is a 1-to-1 binding to the original Qt and their APIs are almost identical, so you should be able to switch to Qt for Python quite easily when it is stable.

By the way, Qt for Python is re-branded from PySide2. They are the same.

Re: Hello Qt for Python

#90
post #89
post #66

Earlier quoted context omitted.

What would you recommend to someone who wants to write Python desktop applications today? I've used wxWindows way back when, and I'd hate to use Electron. Would you go with Qt for Python, or PyQT? Also, what's PySide/PySide2?

As you can see, Qt for Python is not yet stable release. So you will want to use PyQt5 first. I remcommand PyQt5 because there are more resouces available on the internet now. PyQt5 and Qt for Python is a 1-to-1 binding to the original Qt and their APIs are almost identical, so you should be able to switch to Qt for Python quite easily when it is stable. By the way, Qt for Python is re-branded from PySide2. They are…

That's very helpful, thank you!
Post reply on HN