Live data from Hacker News

PyQt5 Tutorial: Create a Python GUI in 2018

build-system.fman.io

101–110 of 211 posts

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#101
post #41

Earlier quoted context omitted.

If you use the complete Qt installer, you get QtDesigner. If you use the PyQT-provided wheels and/or you don'want to mess with the whole Qt, then you can separately install QtCreator, which is very simple and embeds QtDesigner.

Looking at a tutorial, it looks like all it does is layout the form for you. That's a shame. Things closer to what the original VB was are sorely missed in modern computing.

Here you go: vTcl -- just like Visual Basic 3.0.

Also, you get to use Tcl instead of Visual Basic, so even better !

http://vtcl.sourceforge.net/

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#102
post #67

I'd like to take this time to introduce a project I have been working on. I'm using it in production currently. https://github.com/qmlnet/qmlnet It is a perfect balance between QML and .NET. The tech stack splits along the perfect line. QML for UI, .NET for business logic. I'd be glad to answer any questions.

Do you know if it is working fine with F#? Will possibly try it as I learn F# (on Linux).

It does. Any .NET language.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#103

We use Qt heavily at Starsky Robotics. We initially used it because it has tight integration with ROS via RQT [1], but I'm pretty impressed with the framework in general. Lots of great tools out of the box, QtCreator is awesome and once you get the right signal/slot model in your head everything is a breeze. Plus getting to prototyping in python is always fast! For our use case, relative speed of the GUI isn't a fact…

Thank you for not using Electron.

this. I was just about to write that the tutorial should be shown to every Electron developer.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#104

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

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#105

This is a case where the "in 2018" in the title is very helpful, as Googling information about Python and Qt usually returns something dreadfully out of date. (and as other comments note, there are lots of new companion tools/competitors like Electron)

The API still looks messy and unpythonic though, sadly. Look at the basic hello world example. Why do I need to pass QApplication an empty array? Why am I calling a method ending with _ to launch the program? And the fact the label magically attaches to the app through some side effect is also confusing. Does anyone know if there's any good shim/wrapper around PyQt that has a better API?

Since Python 3 you can use exec() instead of exec_() (in Python 2 exec was a keyword).

> And the fact the label magically attaches to the app through some side effect is also confusing.

Are you referring to the first "label.show()" example?

Typically that pattern is rare (~once per app for the main window). Regarding attachment to the app; QApplication is a process-wide singleton. All objects belong to the same app.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#106
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/

[deleted]

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#107
post #91
post #2

Just to note, there are official [1] Python bindings available for Qt and this can usually be installed with `pip install pyside2` . [1] https://www.qt.io/qt-for-python

We use (and pay for) PyQt5 at work. Do you have experience with both and if so can you comment on any tangible differences? If possible, I would rather get behind the "official" one since we also already pay for commercial Qt licenses.

Signal connection behaviour seems to be different in PySide2 regarding non-slot receivers.

E.g. this works in PyQt:

    def f(): pass

    signal.connect(f)
    signal.disconnect(f)
But the disconnect fails in PySide2 (RuntimError: not connected). Seems like you have to store the connection object, which is a bit of a PITA because signal.connect() does not return that.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#108
post #43

Earlier quoted context omitted.

1. wxPython has inconsistent looks and layouts between platforms and monitor resolutions (or DPI). For example, on PlayOnLinux GUI app I cannot click an "OK" button while using Surface Pro because the button is hidden outside of the window. 2. QML is an amazing language. It is modern, declarative and reactive but still very simple to use. Personally I don't want to go back to the traditional GUI coding styles after e…

The article doesn't mention QML at all. Is it possible to use it with Python?

Of course.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#109
post #75

I gave up on QT and decided instead to invest time learning javascript frameworks, which provide a lot more flexibility for creating apps.

Then try QML! You can create Qt apps using JavaScript (it's ES5 though).

ES6 in Qt 5.12

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#110
post #97

Still using tkinter here which is python's default GUI, what's the license for PyQt5? For me learning Qt in general is another big investment of limited time, so far I have been using tkinter with python and it works well.

PyQt5 is GPL; PySide2 is LGPL.

Do note that the PyQt5 authors (Riverbank Computing) have made it explicit that their view of GPL linking (a matter of debate in some circles) is that you can use PyQt5 from MIT/BSD/... applications.

Post reply on HN