Live data from Hacker News

PyQt5 Tutorial: Create a Python GUI in 2018

build-system.fman.io

161–170 of 211 posts

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#161
post #82
post #29

Earlier quoted context omitted.

Flexibility to do what, though? I'm genuinely curious: what doesn't Qt offer that a desktop app might need?

Why do you think programmers of all people are heavily migrating to Electron based editors like VS Code? Because they like using slow and bloated apps? And I'm not talking only of web programmers, I know plenty of C++ programmers who moved to VS Code.

Oh, I appear to have misread your comment as "why developers move to Electron for their apps".

The reason why developers, myself included, migrate to VSCode is really simple: because it's the best all-around cross-platform IDE right now for many scenarios, and because it has a thriving extension ecosystem to tailor it further. But it is that in spite of being written in Electron, not because of it. If Microsoft announced that it is being rewritten in Qt tomorrow, I'd be ecstatic.

Just to give you an example of what kinds of issues using web tech for desktop-like experience can cause:

https://github.com/Microsoft/vscode/issues/22900

(Yes, I'm well aware that they fixed it. The point is that the offending code needed to be written in the first place. A native desktop app using 13% of the CPU to render a blinking cursor would be considered an insane bug to have in the first place.)

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#162
post #139

Earlier quoted context omitted.

well it's a bit old school but it certainly looks functional. If the program under it is good, it's a very superficial comment. If only you'd see my emacs screen, it's unbelievably ugly and somehow, I work with it every day !

I was replying to a post that stated specifically that it was "non-ugly". In 2018, non-ugly means this : * https://assets.guitar-pro.com/1.3/images/www/guitar-pro-7/ca... * https://www.awn.com/sites/default/files/styles/original/publ... * http://www.comptoir-hardware.com/images/stories/_software/am... it's not what I use myself, being more of an i3/terminal guy, but it's absolutely what the clients want

[deleted]

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#163
post #131

Earlier quoted context omitted.

It gives you ui for connecting signals and slots and configuring stuff as well, but few people use it. And qt singals and slots model is far superior to VB/Delphi style callbacks or c# delegates, but you have to program for a while to get why. Also - layouts in VB/Delphi weren't responsive, layouts made in QtDesigner are.

Ahh...responsive layouts in VB, those were the days. Cramming everything into a frame, and looping through each widget to set width to 49% of the frame.....every time they moved/resized the form. It seems a lot more pleasant in my memory that it likely was at the time.

I have some comparison, because I worked with Oracle Forms and qt3 at the same time in my first job. Forms weren't VB, but the principle was the same - everything was set manually.

Once customer bought new monitors and we had to "upgrade" all forms from 800x600 to 1024x768. Took us 3 months. Qt forms worked fine out of the box.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#164

Earlier quoted context omitted.

The reason why I chose PyQt over wxPython was the former's support for custom styles. I wrote an article with my thoughts on picking a GUI framework [1], in case you're interested. 1: https://fman.io/blog/picking-technologies-for-a-desktop-app-...

I am super happy that you seem so dedicated to providing a good UI library in an attempt to keep people off of Electron (I find one of the biggest hurdles to be the ease of getting started/iteration speed). Dumb question time: Is this also usable with QML?

You can use PyQt5 with QML here is a simple application https://github.com/siecje/qml-testing

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#165

Earlier quoted context omitted.

The now-official bindings (Qt for Python as mentioned in the article) has a waaay more Pythonic API. I actually liked it. The advantage of PyQt5 is that you can look up the Qt documentation.

Qt for Python and PyQt5 have almost exactly the same API, to the point where it took me 30 min to migrate my 15kLoC project [1] from the latter to the former, mostly by changing a few imports. Maybe you meant something else? 1: https://fman.io

hmm, then Pyside2 API must have changed significantly. I only used Pyside 1.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#166

I wish all the effort to make Qt available in Python was going in to exposing a C API. I of course know this is difficult due to Qt relying on OO extensibility in many cases and I am aware of many efforts in many languages that just use the C++ API directly by essentially building their own C API layer. That I have to choose between C++ or Python makes it very difficult for many use cases in other languages. What ess…

You can use rust https://github.com/KDE/rust-qt-binding-generator There are Go bindings floating around too

Sure, I am familiar with them all (there's another decent Rust cpp gen one too). That's what I was alluding to with "I am aware of many efforts in many languages that just use the C++ API directly by essentially building their own C API layer." Unfortunately each binding has to do this themselves because there's not a blessed C API.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#167
post #10

Earlier quoted context omitted.

What would you use for an app that needs to look really good and be fast?

Really good? Platform-native APIs.

Agreed, but you can use those from Python, through pywin32 and (for a few rare things that are missing in the former) ctypes.

(If you're on Windows. On Linux, Qt could be considered native. On Mac there is PyObjC. )

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#168
post #155
post #147

Earlier quoted context omitted.

> ui for connecting signals and slots and configuring stuff as well, but few people use it. I try hard to do that (it saves on boilerplate), but the challenge is always in finding signals and slots with the same precise amount of parameters. Say I trigger a signal with no parameters and I want to connect it to a slot that takes a boolean always with the same value (e.g. a pressed() connected to a setEnabled(bool), wh…

I don't consider connecting signals in xml (via designer) better than connecting them in code. The line is still there, just in different place.

But the UI changes very rarely, and it’s out of the way most of the time; whereas the class method is always in the way in parts of code that could see a lot of day-to-day activity, migrations (py3...) and so on.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#169

I've been using a lot of Python GTK via gobject introspection lately. It works fine, or at least a well as GTK ever works. Why would I want to switch to Qt? 1) I like how GTK and Python object lifetime tracking are compatible (both are simply reference counted), where as Qt has this hierarchical model that feels weird in Python and that led to random segfaults when I tried using PyQt for a serious project last year.…

How does the reference counting work in the presence of reference cycles involving both the GTK side and the Python side, e.g. an event handler having a reference to an object that has a reference to the object the handler is attached to?

Do they get collected properly, like they would with pure Python objects, or would you have to break up the cycle?

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#170
post #77

Steve Yegge was a true visionary. In 2004 he predicted the massive popularity of (future) Electron: > web application programming is gradually going to become the most important client-side programming out there. I think it will mostly obsolete all other client-side toolkits: GTK, Java Swing/SWT, Qt, and of course all the platform-specific ones like Cocoa and Win32/MFC https://danluu.com/yegge-predictions/

I raise you a Joel Spolski, 5 months earlier: https://www.joelonsoftware.com/2004/06/13/how-microsoft-lost...

“The new API is HTML, and the new winners in the application development marketplace will be the people who can make HTML sing.”

Post reply on HN