Live data from Hacker News

PyQt5 Tutorial: Create a Python GUI in 2018

build-system.fman.io

41–50 of 211 posts

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#41
post #7

As someone who works with Windows forms, I'm wondering where the visual designer to place widgets is.

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.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#42

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.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#43
post #28

I've been using wxPython for many years, and it works very well. What are the advantages of PyQT over wxPython? Anyone experienced both 'worlds' in a non-trivial application?

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 experienced QML.

3. Qt Designer is a great GUI tool that you can quickly prototype a GUI app.

4. Qt has the best documentation among cross-platform GUI frameworks.

5. Qt is a much bigger framework having more features. For example, you can easily embed WebKit or Chromium very easily.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#44
post #33

Earlier quoted context omitted.

> Why would I want to switch to Qt? Because GTK is awful outside of Linux.

Is it? Why? Works fine for me.

Functionaly it is fine, but its sure doesnt look native on Mac OS or Windows.

Qt looks at least a magnitude better (more native) on those platforms

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#45
post #34

Anybody know if it's easy to reverse engineer or strip parts of the application when deploying PyQt5 apps? Or do you need extra measures to obfuscate the code to protect certain logic?

I've never tried it but given Python's interpreted nature, it is likely pretty easy unless you use an obfuscator. Note that that's true for Java .class files as well. I was really surprised once when I tried to decompile one of my own that I had thought would be safe. You get near-perfect accuracy.

And native code as well.

https://www.hopperapp.com

https://www.hex-rays.com/products/ida/

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#46
post #29

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

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

I assume learning to build interfaces in Javascript allows you to port that skill to both the desktop environment (via something like Electron) or web environment through a browser.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#47

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

You can create custom widgets like some fancy buttons in Qt too but the appeal is to not customize things and let the user platform and theme choice to dictate how things look like.

Qt had layouts years before html got the flexbox and gridbox too so I don't think there is a feature in html that is missing in Qt, Qt also includes QtWebkit if you ever need say to display some html or run some JS so basically you have access to native libraries and to JS/HTML if you need.

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#48
post #33

Earlier quoted context omitted.

> Why would I want to switch to Qt? Because GTK is awful outside of Linux.

I'd argue GTK is awful inside of Linux because of client-side decorations (removal of the standard title-bar) that you cannot disable, removal of the menu bar, and the mobile/tablet first design (some people do use desktops and I'm not allergic to text).

[deleted]

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#49
post #4

I like the tutorial, but I don't know why you would use PyQt these days. Tkinter is more permissive and has wrappers like appJar which make it disgustingly easy to put together a quick, ugly GUI. If you're building a desktop app that needs to really look good and be fast, why are you using Python?

apparently a lot of the normal and terrible problems are worked around using this: https://build-system.fman.io/

Re: PyQt5 Tutorial: Create a Python GUI in 2018

#50
post #34

Anybody know if it's easy to reverse engineer or strip parts of the application when deploying PyQt5 apps? Or do you need extra measures to obfuscate the code to protect certain logic?

I've never tried it but given Python's interpreted nature, it is likely pretty easy unless you use an obfuscator. Note that that's true for Java .class files as well. I was really surprised once when I tried to decompile one of my own that I had thought would be safe. You get near-perfect accuracy.

Yeap, it's pretty easy (see: https://github.com/rocky/python-uncompyle6), although note that if you're worried about decompiling, instead of using an obfuscator, using something as Cython or Nuitka to compile your code should not be difficult -- and as a plus your code becomes faster too ;)
Post reply on HN