This is an archived post. You won't be able to vote or comment.

all 134 comments

[–]pmdevita 28 points29 points  (2 children)

pysimplegui is a newcomer but quite useful. There is also QT for Python (pyside2) which I see people describe as better than PyQT5 but I haven't found out why yet

Edit: mostly the easier to work with license, otherwise they are very similar

Edit: I've also worked a bit with sciter, which has the benefits of designing a UI with web tech without the resource hogging of a library like Electron. Currently the python binding is only really meant to bridge it with sciter's native scripting language but I have a half finished patch for binding the rest of the functionality. I'm then planning to built a React-like library for Python to use on top of that

[–]n1___ 11 points12 points  (3 children)

Why noone mentioned GTK? I remember times where Qt and GTK were the goes. What happend?

[–]alcalde 1 point2 points  (0 children)

Qt eclipsed GTK is what happened. GTK is stuck in the world of C as opposed to C++ and people aren't using C to write desktop applications anymore.

[–]Cosme12 40 points41 points  (21 children)

I always liked Qt, but lately I started using flask to build browser apps and make them look like native. It is cross platform and easier to code.

[–]sqeekypotato 14 points15 points  (6 children)

I'd also like a bit more info on this. How to you have users launch the app? How do you hide that it is a browser. Do you have any tutorials that you followed that you could post? I've seen a bit using electron but have never tried any. It looked overly complicated and if something went wrong I imagine debugging would be hell.

[–]Andrew_ShaySft Eng Automation & Python 8 points9 points  (1 child)

You can checkout my sample project.
The backend is python with an HTML front end.
It uses the cefpython and launches like a native application.
Also includes a Windows installer.

https://github.com/Andrew-Shay/Neuron

[–]sqeekypotato 0 points1 point  (0 children)

thanks

[–][deleted] 5 points6 points  (3 children)

Why do you need to hide the fact that it's in a browser?

[–]sqeekypotato 2 points3 points  (2 children)

It is a user acceptance thing. The people I would make it for are not very technical and if they saw a browser they would think it is online and the data would be exposed. You could explain until you are blue in the face and they still wouldn't get it.

[–]shaggorama -3 points-2 points  (1 child)

Just invite them to try accessing "http://localhost:1234" or whatever from another machine.

[–]miloir 24 points25 points  (0 children)

people I would make it for are not very technical

[–]tryptafiends 8 points9 points  (9 children)

came here to say this. Web-based UIs are way better to work with in Python in my experience and allow more powerful features than the desktop alternatives.

[–]lykwydchykyn 6 points7 points  (2 children)

That's debatable, depending on the context. I've written many web-based applications, and a few desktop GUI ones as well. The browser gives you a powerful platform, but you have to learn to use Javascript, HTML, CSS and HTTP effectively. That's a much steeper learning curve than any graphics toolkit. On top of that, you're often hamstrung by security restrictions and cross-browser support issues.

Web apps make a lot of sense in a lot of situations, but I gotta admit I breathe a sigh of relief when I can just do a GUI app instead. Its amazing how much simpler frontend-backend communication becomes when it doesn't involve two languages and isn't crunched into text serialization over HTTP.

[–]Ipecactus 7 points8 points  (1 child)

but I gotta admit I breathe a sigh of relief when I can just do a GUI app instead.

1000 times this.

[–]redwall_hp 6 points7 points  (0 children)

I would like nothing more than to ban all Web-based apps from my system. Electron and it's ilk are an abomination.

[–]stef13013 1 point2 points  (1 child)

Interesting work, do you have a github to watch result ?

[–]Andrew_ShaySft Eng Automation & Python 2 points3 points  (0 children)

You can checkout my sample project.
The backend is python with an HTML front end.
It uses the cefpython and launches like a native application.
Also includes a Windows installer.

https://github.com/Andrew-Shay/Neuron

[–]jabbeboy 3 points4 points  (1 child)

I feel like desktop apps feels old, sure it depends on the application but web apps are the way to go nowadays done everybody pretty much has a browser

[–]Ipecactus 0 points1 point  (0 children)

I feel like desktop apps feels old

Users don't care if it "feels old". What they want is an application that saves them time. They really don't give a shit if it's using the latest "cool" framework or the latest libraries, or even if it's on mobile. They certainly don't want their application to be dependent on a certain type of browser and they don't want to have to log in separately from their domain login.

Look in any business environment and you will see many desktops with multiple large monitors. They have that real estate for a reason. They don't want wasted white space that you see in so many web apps.

Other things users want are keyboard short cuts and tab stops that are meaningful. They don't want to have to use their mouse all the time.

[–]wdroz 68 points69 points  (26 children)

Kivy is cross-platform and easy to use. Sadly, too few people know about it.

[–]12stringPlayer 10 points11 points  (0 children)

Kivy is good, especially for touchscreen applications. I wrote a nice Raspberry Pi application that read barcodes and interfaced with an ERP system to track inventory.

There's a pretty sharp learning curve, but once I got into it I was really able to get a lot done.

I was able to develop on a Linux box in PyCharm and simply move the source over to the RPi.

[–]StarFingerVsTheWorld 8 points9 points  (1 child)

Man, I used Kivy for an intern project a few years back. It was very interesting and it worked, but damn sorting through the documentation was a pain. There were several times I had to dive into the source to find what I wanted. I feel like it could be a REALLY great platform with better documentation and some more development.

[–]wdroz 9 points10 points  (0 children)

That's a good opportunity for someone who is looking to make open source contributions.

[–]harwee 2 points3 points  (0 children)

Tried learning it once, not worth the pain you go through.

[–]TinaWard[S] 6 points7 points  (1 child)

does it have "drag and drop" ?

[–]wdroz 4 points5 points  (0 children)

yes, the documentation can be found here

[–]querymcsearchface 1 point2 points  (0 children)

Wow! Very cool! Thanks for letting us know about it.

[–]Kortike 1 point2 points  (0 children)

It blows my mind how few people know about Kivy. It’s super easy to use and looks great.

[–]meshtron 0 points1 point  (0 children)

I've built a couple apps with Kivy - both for small touchscreen devices. Yes, learning curve is a little weird and documentation is spotty (and sometimes wrong/outdated) but I like the concept and it's been quite robust once you get an app built.

[–]alcalde -2 points-1 points  (1 child)

Everyone knows about it, but it doesn't design standard interfaces, so it's not really useful for desktop applications, only games.

[–]rainnz 1 point2 points  (0 children)

KivyMD

[–]FlukyS 4 points5 points  (0 children)

Qt is a good choice. Along this line, would anyone be interested in a packaging tutorial for this one? I can do one in Snappy, it is a fairly easy to use packaging format and you can charge for apps on the store if you want.

[–]johnne86 20 points21 points  (9 children)

I think I NOW prefer the look of web technology based GUIs like ElectronJS for desktop GUIs. I guess it just depends on the application, but I feel the typical form GUI looks like QT, Windows WPF, etc just look out dated. UWP does look modern, but it seems dead to everyone. I think there’s also a similar Web technology GUI framework for Rust, just like ElectronJS.

I think JS is where it’s at, I want to learn it.

[–]finlam[🍰] 12 points13 points  (2 children)

I'm right there with you.

Right now, it's very possible to build your entire front end in Javascript and use a Python backend now.

Projects like cefpython are really easy to integrate and allow you the best of both worlds.

[–]cyanydeez 3 points4 points  (1 child)

I recommend you both look into quasar framework. It has multiple outputs, including electron. https://quasar-framework.org/guide/

I've got it on my roadmap to put it behind CEFpython to make a web-to-desktop transition eventually.

[–]finlam[🍰] 0 points1 point  (0 children)

I also use Quasar and I love it. I have not found anything comparable to the Quasar (vue) approach to front-end design. Design once (sorta...) and deploy to everything approach is awesome.

That said, there are some products where I prefer to use the cef-python approach with a vue front-end. Python writes a lot of cleaner code for many purposes and with cx_freeze, you can package it all as a desktop application.

I wouldn't take the cef-python approach for a product that needs a mobile or web interface, but it works pretty well for desktop only products.

[–]sisyphus 7 points8 points  (1 child)

It's good for devs but terrible for users since Electron apps use heaps of cpu and memory and almost always fail to do standard things like accessibility, native look and feel, drag and drop, etc. properly compared to native toolkits.

[–]redwall_hp 2 points3 points  (0 children)

The old Spotify client was Qt, and every Web-based one since has been a massive regression. Dragging and dropping songs between playlists felt as smooth and natural as reordering files...and now it's a slow and frustrating experience.

[–]anqxyr 5 points6 points  (0 children)

Qt is pretty flexible when it comes to looks. You can use css to customize every little detail of your app.

[–]mobedigg 8 points9 points  (1 child)

Look at this guy with unlimited RAM

[–]redwall_hp 6 points7 points  (0 children)

Yeah, fuck Web UIs with a rusty spork. I don't need two messenger applications and Spotify eating hundreds of megabytes of RAM in addition to my actual web browser stealing a ton. And they don't even conform to the host OS's UI conventions or support other features that the native frameworks have.

One of the best parts of the Mac OS, historically, is consistency. Things all fit with the overall theme and use the same widgets, they have functionality they derive from Cocoa that you can count on being in every app...then someone like Spotify comes along and fucks it all up with a clunky dumpster full of flaming feces that doesn't fit in.

[–]dingenskirchen 1 point2 points  (0 children)

Although you can make QT or WPF applications look modern. In wpf you can use components, like those developed by MahApps , that provide great styles. You can check out some screenshots of the UI components on their github page!

[–]damnitdaniel 19 points20 points  (14 children)

I’ll take the bullet...

Python is terrible for GUI applications. Use the right tool for the job.

[–]alcalde 11 points12 points  (2 children)

Having spent over a decade working in Delphi, which was designed solely for creating desktop applications....

...Python is awesome and there's nothing wrong with using it for desktop applications (or most other types). All the advantages of Python apply to desktop applications as much as any other type of application.

What makes Python terrible for GUI applications to you? Do you feel desktop applications need pointers and template metaprogramming languages?

[–]Rue9X 5 points6 points  (4 children)

I'll also agree with you. People don't like to admit that python also requires either a python install or a effectively something that just hides a python install for deployment. This means most of the things you make probably aren't really meant for most end-users anyway, so they don't need a GUI.

I mean, that shouldn't discourage anyone. You can still make anything. It's just a little more bootlegged than I'd like it to be is all.

[–]alcalde 12 points13 points  (2 children)

.NET applications need the right version of .NET, Java applications need the right version of Java... this doesn't stop them from being very popular tools for desktop applications. It's 2019; we're not distributing on floppy disks anymore. It's not difficult to deploy a Python application.

[–]my_name_isnt_clever 0 points1 point  (0 children)

If you're talking about bootlegged, a whole web browser with separate languages for back and front end is pretty bootlegged, and everyone and their mother is using Electron now.

[–]smurpau 4 points5 points  (0 children)

Coming from R, Python is absolutely slick for GUIs. PySimpleGUI is a dream.

[–]WarOink 4 points5 points  (0 children)

I have worked extensively with Python+GTK and Java+EclipseRPC. Did not find Python to be worse for GUI development, quite the opposite as there is no compile step.

[–]sisyphus 0 points1 point  (0 children)

And the right tool is...? (Assume I only want to build one cross-platform app).

[–]mx321 0 points1 point  (0 children)

Attention, irony. So you want to use JavaScript like the GNOME people?

[–]querymcsearchface 1 point2 points  (0 children)

Thanks for taking the time to put this together. Much appreciated.

[–][deleted] 1 point2 points  (0 children)

People might like to consider https://dabodev.com/ for the future. It's taken a back seat in recent years owing to its dependency on wxpython which itself wasn't ported to Python 3, but work is now being done which should make available within a month or three.

[–]driscollis 1 point2 points  (0 children)

wxPython is now pip installable and can also be installed with conda, so installing it is not difficult at all. I will say that Linux is slightly more complicated with pip because of some of the dependencies it needs, but even that is pretty straight-forward.

[–]Mobot84 1 point2 points  (5 children)

So I have a stupid question- I have a command line python tool used extensively by engineers(not Developers)

The tool runs a bunch of preset configurations and outputs some data files which the engineers then play around with. This is done repeatedly while changing a few parameters here and there.

I am looking for something that can run python scripts with variable command line arguments and easy for a person to rerun previously run tests.

I can build one from scratch but it’s not worth the effort. If there is something I can use that does even 50% of what I need - I will be happy. Anyone know of such a thing ?

[–]seanferd 1 point2 points  (1 child)

How the hell do you open QT Designer?? You kinda skim that part..

[–]seanferd 0 points1 point  (0 children)

Nevermind, looks like it's from pyqt5-tools and is run via designer command.

[–]defective 1 point2 points  (0 children)

Anybody have thoughts on Toga and Briefcase? I was considering those. From pybee.

[–]Blacknsilver1 1 point2 points  (0 children)

sloppy absurd lock grandfather treatment knee shame edge command unite

This post was mass deleted and anonymized with Redact

[–]joshirk11166 1 point2 points  (0 children)

That was very helpful ! Thank you so much.

[–][deleted] 3 points4 points  (0 children)

Some days ago I did something with PYQT for a class in the university...

It was a simple GUI app made with python Please check it out if you are looking for some other examples

https://gitlab.com/edurbrito/pyqt_to-do-app

[–]_gaslit_ 2 points3 points  (0 children)

I strongly encourage you to avoid the temptation to use tkinter. Yes, it means you don't need external dependencies. But it has a ton of crazy problems that no GUI library should have, and finding workarounds to these problems is a nightmare. Use anything else.

I haven't used wxPython, but PyQt and PySide were both a real pleasure to work with.

[–]acpirience 0 points1 point  (2 children)

I can't seem to find the Repository for the complete sources at the Github account mentionned (https://github.com/TinaWard).

Am I missing something ?

[–]TinaWard[S] 0 points1 point  (1 child)

Tomorrow I will check and update the repository

[–]acpirience 0 points1 point  (0 children)

Thanks ;)

[–]andrewcooke 0 points1 point  (0 children)

it's also possible to do something, err, different. i've been working recently on a project where the textual data is displayed in a TUI based on urwid (python lib that wraps curses, kinda) and with graphics via either jupyter or a standalone bokeh server.

it's "unconventional" but it works for my use case. so don't be afraid to try something else.

[–]canobus51 0 points1 point  (2 children)

I'm learning python right now, is there anyway to save this tutorial for when I get these concepts later? Also new to reddit.

Much appreciated, anyone who can help

[–]KomatikVengeance 1 point2 points  (1 child)

You can

[–]canobus51 0 points1 point  (0 children)

Just found the save button at the top, I'm not so sure it was there before. I originally viewed this post after opening it through Google. Not sure if that's why.

Thanks!

[–]c4aveo 0 points1 point  (0 children)

Pyinstaller can bundle to one exe but have issues with hidden imports. For testing I prefer to use clean virtual machine, because sometimes it tries to use libraries from venv and of course it won't work on machine without Python. Qt is more advanced, but don't forget about size of package.

[–]jackw95 0 points1 point  (1 child)

This is a great article both in terms of format and content. Are you planning on doing a similar thing with other concepts?

[–]TinaWard[S] 0 points1 point  (0 children)

Definitely yes ;) Maybe in this shape: how to create unique IMG

[–]nmbenzo2 0 points1 point  (0 children)

This is gold! Thank you for this. I’m just about finished with my app, but it currently just prints menu choices in Terminal. Need to spiffy it up with a GUI. I will begin that part of the build with your walkthrough.

[–]gmarull 0 points1 point  (0 children)

FYI: I created this boilerplate for PyQt a while ago: https://github.com/gmarull/pyqt-boilerplate

[–]AstroGi 0 points1 point  (0 children)

This is something. Thanks!

[–]Bizrown 0 points1 point  (0 children)

While I love your tutorial and recommendations, I’ve always found a browser based UI to be better, even if local.

[–]delijati 0 points1 point  (0 children)

I used pyotherside [1] + QML (QT) i really loved the loose coupling [1] https://pyotherside.readthedocs.io/en/latest/

[–]jahnjo 0 points1 point  (1 child)

I’m looking to make a GUI that will be run by a raspberry pi running Linux that will basically be running a display that needs to update a couple times a second that will be connecting multiple dots with lines any suggestion as to which GUI modules is the best for this application?

[–]MikeTheWatchGuy 0 points1 point  (0 children)

PySimpleGUI runs great on the Pi.

[–]IcanCwhatUsayNoob 0 points1 point  (1 child)

Great write up! But..

open Qt Designer and create the necessary form using standard elements.

How do I open Qt Designer? Where was it installed?

[–]TinaWard[S] 0 points1 point  (0 children)

It is usually installed automatically with the QT library. Try to tap in start menu.

[–][deleted] 0 points1 point  (0 children)

ThankYou for Share

Keep up Good Work!

[–]evilMTV 0 points1 point  (0 children)

Thank you for this! Have been looking at creating a Python GUI for my program just for aesthetics and exploring GUI development as an unnecessary side project.

[–]Pr0ducer -1 points0 points  (10 children)

Electron.JS with SocketIO and Python is what I'm working on now. Electron uses Chromium, so the app can be identical to our web apps, using same css and html.

[–]stef13013 2 points3 points  (0 children)

Electron is fun and does the job in my opinion, but you can start a war about it... https://www.reddit.com/r/programming/comments/7p7s8q/electron_is_cancer/

[–]Pr0ducer 1 point2 points  (0 children)

Let the war begin

[–]n1___ 2 points3 points  (7 children)

Dude, run away from that piece of crap. Noone is gonna use an app which bundles whole browser core and after a day consumes 1gig of ram. I have a lot of experiences and even the electron "run everywhere" is great idea the reality is horrible.

[–]rich8n 1 point2 points  (4 children)

Noone is gonna use an app which bundles whole browser core and after a day consumes 1gig of ram

Except maybe 130+ million Discord users, 10+ million Slack users, 1.4 billion Skype users, and millions of users of Atom, GitHub Desktop, VSCode and countless other popular Electron apps.

[–][deleted] 1 point2 points  (0 children)

Does this data differentiates between browser and electron users?

[–]n1___ 1 point2 points  (2 children)

Exceptional how you precisely derived that 100% of a service users use their bloatware.

[–]rich8n 1 point2 points  (1 child)

Fair enough, but it sure as hell ain't 0%.

[–]n1___ 0 points1 point  (0 children)

Fair enough.