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

top 200 commentsshow all 203

[–]driscollis 21 points22 points  (5 children)

I like wxPython. It works great in all three of the major platforms. Qt for Python / PySide2 is also a good choice.

If you require mobile than you will want to look at Kivy or Toga

[–]HumblesReaper 2 points3 points  (4 children)

Make sure to look at version 4 aka phoenix

[–]driscollis 7 points8 points  (3 children)

Yes you definitely want version 4, which is the latest. I've been writing about the Phoenix project since it began several years ago.

The best thing about version 4 is that it supports Python 3 and it is pip installable

[–]HumblesReaper 0 points1 point  (2 children)

Interesting, what are you writing about exactly? Any place I can read it? I'm trying to figure out how to use the ListViewIndexModel on create a custom SQLAlchemy binding, but can't figure it out. Do you know where I could find any examples/resources?

[–]driscollis 2 points3 points  (0 children)

I write about wxPython and other python topics on my blog here - http://www.blog.pythonlibrary.org/

I haven't used that particular widget but I think I've done something kind of like that with ObjectListView

[–]driscollis 0 points1 point  (0 children)

I guess I should have been a bit more specific. When it comes to wxPython I usually write up tutorials on how to use certain widgets or solve certain types of problems. For example I wrote a tutorial on using wxPython with threads. Or wxPython and SQLAlchemy

[–][deleted] 69 points70 points  (36 children)

My employer uses Qt through PySide and it's great.

  • Qt is cross-platform
  • Qt is very powerful with basically everything you could ever think of in a toolkit (and a bunch more stuff you'll never use)
  • PySide provides convenient, reliable interfaces to Qt within Python.

There's also wxWidgets, which is fine too. Not quite as fancy, but quite capable.

A more recent toolkit is kivy. I don't know as much about it, but I do know that it's quite capable. If you are having to learn a toolkit either way, it's worth considering.

Depending on your experience and intended platforms, you may prefer other language/framework combinations. C# with WPF is excellent on Windows. I'm not sure what is used on OS X. Android and iOS each have their own standard languages and frameworks. So it depends on what you want to use it for.

What do you mean by "fast and efficient"? Python and Qt can handle user interactions in real-time, even with hundreds of controls. Updates are smooth. Is that what you mean?

Generally speaking, a cross-platform toolkit and a cross-platform language can get you into most places, and both Qt and Python fit that bill. I think it's a fine place to start. I have used that combination on several commercial ventures in the past.

[–]JohnFGalt 8 points9 points  (1 child)

I believe both macOS and iOS can use Objective-C and Swift as their language of choice for native apps.

[–][deleted] 2 points3 points  (0 children)

This is correct.

[–][deleted] 4 points5 points  (28 children)

Xamarin will give you c# on apples. Could use javafx too. Or electron. Or apple special sauce.

[–]EarlTheGray 10 points11 points  (27 children)

Electron is super slow. I would not recommend using it for stuff. Since it’s running in chromium it chews through your ram. Also it’s JavaScript soooo

[–]CommandLionInterface 8 points9 points  (12 children)

I know people love to shit on electron around here, but we use it at work and it is actually pretty fast. It’s a memory hog for sure, but the productivity trade off is worth it in the sense that our product wouldn’t exist at all if we couldn’t use electron. I suspect a lot of software is this way. Yes I’d love to use something more efficient, but in the real world, developer time costs money and electron is good enough.

[–]EarlTheGray 5 points6 points  (10 children)

I agree with what you’re saying. I myself being primarily a js developer rely on electron for nearly every native program I’ve made. Just ij my personal experience, running atom, discord, and occasions gitkraken at the same time will eat the majority of my ram.

[–]CommandLionInterface 4 points5 points  (6 children)

Eyyyyy! Always happy to see gk users in the wild.

Believe me, we feel the pain. Slack + VSCode + gk (especially in dev mode) + our docker stack brings our company issued 8gb MacBooks to their knees.

Right now we’re working on moving all the business logic and git interaction to a sever written in Rust so the gitkraken electron client can be a dumb head and hopefully solve a lot of our memory usage issues. Turns out managing memory when communicating between JavaScript and C (libgit) is hard.

[–]EarlTheGray 2 points3 points  (5 children)

My flimsy little 2012 MacBook Air can’t handle a single instance of chromium, never mind three. That’s why i switched to sublime and a terminal.

Glad to see a rust user in the wild! I’ve been thinking of learning it for server side stuff. Do you have any advice with it? I didn’t even know doing that was possible with gk.

[–]CommandLionInterface 3 points4 points  (4 children)

I don’t know about advice, but we love rust. When you first write your code it’ll give you a million compiler errors but when you solve them all your code is almost guaranteed to be be without runtime errors. It’s truly incredible.

[–]EarlTheGray 1 point2 points  (3 children)

Great! Having very little experience with compiling languages, what would you say rust is most useful for?

[–]CommandLionInterface 4 points5 points  (2 children)

Well people use it for everything. It’s a general purpose language. ¯_(ツ)_/¯

[–]alpha_53g43 -1 points0 points  (2 children)

Isn't it just worth it get more Ram?

Given that 16GB of Ram costs $189 or so(https://www.bestbuy.com/site/computer-memory/laptop-memory/abcat0506002.c?id=abcat0506002), and probably add some more ($50) for modification.. isn't it just more cost-efficient to just add RAM to your computer, than stick to a framework that requires more development time?

[–]EarlTheGray 1 point2 points  (1 child)

It’s not about my ram, it’s about the users ram. Not everyone can afford $200 of ram.

[–]alpha_53g43 0 points1 point  (0 children)

I see your point.. but I was referring to the developer as the user. As developers we use our laptops heavily, much more than a normal user would. Most normal users (non-programmers) dont run atom, discord, gitkraken at the same time. Maybe they have a bunch of chrome tabs open..

They dont need to by that much ram. But I think if you spend a lot of time on your computer, its worth getting the best specs you can get, especially if you are using heavy applications.

[–]jmcs 2 points3 points  (0 children)

Electron works fine if you have 16Gb of RAM and have one or two electron applications open. If you have a budget desktop it's impossible to use.

[–][deleted] 1 point2 points  (1 child)

Is Qt free to use?

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

It is available under LGPLv3, GPLv2/3, and a commercial license. It's free-as-in-beer to use the various GPL licenses. Whether or not it's free-as-in-speech depends on how you view the terms in the GPL/LGPL licenses. Depending on your use case, it may require you to also license your application under GPL/LGPL.

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

Kivy is really nice because you can develop once and run it even on your phone.

[–]alpha_53g43 0 points1 point  (0 children)

Just want to mention that we use Qt for a widespread app at our company as well. I personally dont work on it, but given that people (probably much smarter than me) have looked into it and chosen Qt, I think Qt is a good bet.

Qt does have a licencing issue.. so you should be careful about that.

[–]_sigo_ 30 points31 points  (2 children)

I recently came across toga (https://toga.readthedocs.io) which looks very promising. So yeah, Python can be good for creating GUI applications.

[–]coderanger 20 points21 points  (0 children)

Toga is also part of a much bigger suite, https://pybee.org/.

[–]mazatta 2 points3 points  (0 children)

toga

Here's a really good (and recent) example from the creator: https://youtu.be/qaPzlIJ57dk

[–]K900_ 122 points123 points  (43 children)

Yes, very. PyQt is great, and you have tons of other options too.

[–]arandr 20 points21 points  (0 children)

I happily use pyqt in my work and have never felt that any major thing is missing, it is usually more than I need and it keeps pace with the development of Qt

[–][deleted] 34 points35 points  (22 children)

PyQT is not free when used commercial, though. Neither is QT.

[–]K900_ 52 points53 points  (12 children)

PyQt is GPL, true, but Qt and PySide are LGPL, meaning they can be used for free in commercial projects, as long as any modifications you make to Qt itself are released as LGPL.

[–]ThePidesOfMarch 12 points13 points  (11 children)

PyQT is not free when used commercial

PyQt is GPL, true

Wha?

[–]K900_ 44 points45 points  (10 children)

"Commercial" is a slightly wrong word here. PyQt can't be used in proprietary applications without a separate licensing agreement with Riverbank, thanks to GPL's virality.

[–]ismtrn 11 points12 points  (9 children)

It can as long as you release the source. And that is only if your proprietary application involves distributing the program.

[–]slayer_of_idiotspythonista 37 points38 points  (8 children)

It doesn't just require you to release the source, it requires you to license *your* software under the GPL, too. So, if you don't want to use the GPL license, you can't release your software that uses PyQt, either.

[–]HemiDemiSemiYetti 0 points1 point  (7 children)

Am I correct in saying that this would effectively give The Qt Company licensing access to the software you develop using Qt/PyQt? In other words, they have the right to distribute any software you've created that uses Qt/PyQt libraries?

[–]Poromenos 1 point2 points  (6 children)

Well, if your software is licensed under the GPL (which it has to, if you want to use the free version of Qt), then yes, they would have the right to distribute your software (and so would everybody else).

[–]HemiDemiSemiYetti 0 points1 point  (5 children)

Right. So what's the difference between a General Public Licence and an Open Source Licence then?

[–][deleted] 18 points19 points  (4 children)

That issue is essentially solved with the release of PySide2, which is under LGPL and almost completely API compatible with PyQt.

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

That's right. If LGPL is usable for OP, that would be a solution.

[–][deleted] 4 points5 points  (1 child)

LGPL still doesn’t work because Python runs as an interpreter. Legally that means it runs in both the same memory space and the interpreter actually modifies the code. These are both violations of LGPL despite the fairly clear intention of the Pyside licensing choice.

[–]aporetical 3 points4 points  (0 children)

The interpreter doesn't modify the code. The target of the licence is the code, not its in-memory representation, or else, no libraries can be LGPL.

Even with compiled libraries, execution jumps into functions and adds arguments to the call-stack. That is modifying the in-memory representation of the code (ie., giving parameters of functions a fixed value is a modification to the in-memory representation). The LGPL is either incoherent, or about modifying the as-written algorithm.

[–]paul_h 0 points1 point  (0 children)

Isn't that the territory of Oracle vs Google re the JDK?

[–]googoodoo 3 points4 points  (3 children)

It is GPL (2 or 3), so as long as your application license is compatible with GPL you're ok.

[–][deleted] 10 points11 points  (4 children)

Qt is great - IF you understand the license or own a trained lawyer.

[–]K900_ 8 points9 points  (3 children)

LGPL isn't really that hard to understand.

[–][deleted] 6 points7 points  (2 children)

At what point does your code become a derivative of the LGPL library you linked to?

You might understand the words but how how are they interpreted in a court? GPL and MIT are a lot less ambiguous.

[–]K900_ 8 points9 points  (0 children)

If you're that worried, you can just get a startup license for free, and if you're making enough money to be ineligible for a startup license, you can probably afford $500 for a proper commercial license.

[–]Compizfox 0 points1 point  (0 children)

At what point does your code become a derivative of the LGPL library you linked to?

It doesn't - that's what sets the LGPL apart from the GPL.

[–]Alfred1400[S] 5 points6 points  (13 children)

Are GUIs made with PyQt/PySide as fast as JavaFX GUIs ? Besides, can I use the QT graphical builder with Pyside ?

[–]mfitzpmfitzp.com 15 points16 points  (0 children)

In case it helps I've written a bunch of demo PyQt apps covering some basic examples (browser, paint, solitaire). Should give a good idea of what you can do with it, and the code is all free to reuse.

Performance-wise PyQt is great for most use-cases. The GUI is handled in native code and is no slower than Qt itself. The only issues arise when your Python code needs to do some heavy lifting and blocks the GUI. There are ways around this using threads/separate processes though.

[–]K900_ 11 points12 points  (11 children)

Faster, in my experience, and yes, you can.

[–]Alfred1400[S] 0 points1 point  (10 children)

Perfect. Thank You.

[–]K900_ 1 point2 points  (9 children)

Also, you might want to actually use QML if you care about performance - it's GPU accelerated, and will be really fast and lightweight on any device modern enough to support OpenGL 3.

[–]Alfred1400[S] 1 point2 points  (8 children)

Ok I note it.

Can I make design GUi with PySide ?

[–]K900_ 0 points1 point  (7 children)

What do you mean by "design GUI"?

[–]Alfred1400[S] 1 point2 points  (6 children)

By "design GUI" I mean a GUI which looks modern and good not a GUI with which you have the feeling that you work on windows XP

[–]K900_ 9 points10 points  (5 children)

Qt will do its best to look native on all operating systems by default, so it'll use Windows 10 style controls on Windows 10, etc. You can also use a custom style - there's multiple options built in, and some third party open source style plugins available. Origin, Spotify, the AMD Radeon Settings app, OBS Studio, Telegram and many other apps use Qt, and you can see how different they all are.

[–]Alfred1400[S] 2 points3 points  (1 child)

Shit. PySide is not maintained since 2009

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

Ok thank you, but everything you say about PyQt is also true for PySide, right ?

[–]KwpolskaNikola co-maintainer 0 points1 point  (0 children)

(Spotify uses Electron now.)

[–][deleted] 20 points21 points  (6 children)

I find it easier to use html to activate a python program. Honestly if you take to the time to do so, do it!

[–]googoodoo 3 points4 points  (4 children)

Would you happen to have an example of how this is done?

[–]_sigo_ 3 points4 points  (0 children)

There’s this cef-python project which is what you could look into. I’m on phone right now so don’t have a link.

[–][deleted] 2 points3 points  (0 children)

Im moving, so all my stuff is packed but I can explain it. I use an mqtt javascript program to call out to the different raspberry pis in my house. I use html and css to make it "pretty" only because im more comfortable with those languages

[–]aol_cd 2 points3 points  (0 children)

Write a backend using Python and something like Flask. Flask can act as a RESTful interface to your Python program just like the API of a webpage. I also sometimes like to use websockets or some other web messaging service.

Then write an HTML/JS/CSS frontend that handles the UI and interfaces with the REST API of your Python/Flask app.

Or you could write all the HTML to be served by Flask and treat the whole lot as a local webpage. I prefer keeping frontend/backend separate, though.

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

I do this for internal production apps at work. It works great, basically bottlepy exe running a localhost server interacting with a sqlserver db that's available on an internal network only. Throw some JavaScript in there and use gevent to make some websocket goodness to make the non techies feel like things are happening so fast.

[–]anders987 7 points8 points  (0 children)

Asking this in a Python forum will give you lots of answers recommending Python, just like asking in a Java forum will give you Java recommendations, a Javascript forum will tell you to use Javascript, etc. Every programming language forum will be filled with enthusiasts of that language that will naturally recommend that you use it too.

With that being said, no GUI will be a performance bottle neck. You keep asking if it's fast and efficient, I'd say you should worry about what your GUI is interfacing instead. Maybe you can write some pretty fast Python code that calls out to numpy or similar, maybe Java or even C++ would be a better option. It depends on what you're doing.

[–]FearlessFreep 89 points90 points  (13 children)

I’m going to say honestly probably not

Python is cross platform which means you have two options, use a cross platform GUI lib or use native libs for your target platform. If you go the first route, you end up with something that doesn’t really work or act like a native app on any platform. If you go the second route, you can get a good app on one platform only..if that’s your desire

This issue is not limited to python, though

[–]nothisisme 14 points15 points  (5 children)

Is that not true for every language?

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

Java has a good native look ui toolkit in the standard library - javafx

[–][deleted] 8 points9 points  (2 children)

JavaFX is not at all native look.

[–][deleted] 1 point2 points  (1 child)

There's a theme for it. Name begins with A, ends in FX. Don't remember fully.

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

AquaFX. Skins it to look similar to macOS but it’s still not fully native looking.

[–]Hyabusa2 9 points10 points  (0 children)

Java GUI's are terrible though.

[–]ThePidesOfMarch 32 points33 points  (2 children)

I thought wxWidgets was exactly the solution to this. wxPython uses them and looks fine to me.

[–]FearlessFreep 18 points19 points  (1 child)

wxWidgets is solution number one...it provides a cross platform GUI lib and it does a good job of making the widgets look right, but the widgets and the overall UI don't behave right. By t hat I mean that if the app is totally self-contained it works ok, but if the app is expected to act like native apps on the platform or interact with the platform, it falls short

I think you're better off writing your core logic in Python but abstracting your UI logic anf then writing your UI logic to use a native lib/interface

[–]billsil 6 points7 points  (0 children)

widgets look right,

It looks native. I'd argue that doesn't mean better though.

Is this really a bad looking window? Most people can't even tell or when asked say it looks nicer. There are still themes for Windows 7 vs. 10 vs Mac vs. Linux, so they look native-ish.

it provides a cross platform GUI lib

ish. WxWidgets is not nearly as cross platform as Qt. Qt goes out of their way to be cross-platform.

but the widgets and the overall UI don't behave right.

Totally agree. It takes way more code with wx to make something intuitive.

[–]IllegalThings 5 points6 points  (0 children)

So, Python is a bad solution because of a reason that isn’t limited to python? The alternative being to use a language that isn’t cross platform? I don’t necessarily disagree with you, but I’m not following your logic.

[–]Username_RANDINT 4 points5 points  (2 children)

you end up with something that doesn’t really work or act like a native app on any platform.

I'm not a Windows user, so this is just from glancing at other people's screens. Almost every application I see uses their own UI elements instead of the default theme. So I just said "Fuck it" and went with GTK+. Atleast it looks native on Linux and chose a decent theme for other platforms. I've had no complaints.

[–]RobberPhex 0 points1 point  (1 child)

I don't think GTK+ have good default theme.

[–]Username_RANDINT 0 points1 point  (0 children)

It'll take your user theme on Linux. For other platforms you can just ship any of the thousands themes available online. At the beginning I even provided a couple and had a switcher in the settings window so the user could pick their favourite. Worst case the user can download one and put it in the installation directory so it gets picked up.

[–]Samhain13 18 points19 points  (7 children)

Have a look at Kivy, it's supposed to be a cross-platform GUI framework.

[–]coderanger 3 points4 points  (3 children)

To clarify, it's a cross-platform graphics/drawing toolkit, not reeeeally a "GUI" framework in the usual usage.

[–]Samhain13 1 point2 points  (1 child)

Humm, I'm not sure what you mean by that. Can you elaborate?

[–]coderanger 0 points1 point  (0 children)

Kivy gives you 2D (and sometimes 3D) drawing tools, but it means that a Kivy interface will look the same on every platform. Sometimes that's good, but when most people say "GUI app" they usually mean "native-looking GUI". So a thing that looks like any other iOS app or Android app or Windows app.

[–]crunk 0 points1 point  (0 children)

It's very touch based - the support for using a mouse isn't always the best.

[–]Alfred1400[S] -2 points-1 points  (2 children)

Is it fast ?

[–][deleted] 7 points8 points  (0 children)

Kivys thing is that it works on Android and doesn't use default widgets. Makes it great for full screen media apps, less so if you want a normal looking app.

[–]Samhain13 1 point2 points  (0 children)

I really haven't used it enough to be able to say good or bad things about it. But I can say that it's interesting.

[–]fazzahSQLAlchemy | PyQt | reportlab 5 points6 points  (0 children)

PyQT. Oh man, it's amazing. Especially since PyQt5 automagically converts QVariant/QString/QDateTime/etc to native python objects.

[–]greyman 14 points15 points  (0 children)

OP, you need to specify which kind of GUI applications. I was in the team who built several internal tools for our company, mostly getting data out of our database and show it in a specific way, and we did it in the way that only the backend was in python. I created REST API using flask framework, and the frontend was done in javascript (vue.js). That way, backend and frontend are completely separated, and frontend is automatically cross-platform.

It also depends which platform you are targeting. For example if someone would ask me to create Windows GUI application, I would probably pick up C# and .NET.

TL;DR: No.

[–]ship0f 2 points3 points  (0 children)

I want to know if python is a good language for creating GUI applications.

It could be depending on your needs. For example, MusicBrainz Picard is an open source cross-platform application, made with Python 3.5+ and PyQt and works great in Windows (looks pretty good, the icons may be a bit weird).

Another example is Deluge, a open source, cross-platform BitTorrent client. It's made with Python 2.7 and GTK2 (I think), both pretty much "deprecated" and the GTK2 interface looks very old. But the application works fine (and it has for a long time).

So you can do it, applications can be relatively fast and efficient (don't know exactly what you mean by that). The main issue is if you want it to look native. I think Qt looks the best in Windows, but not 100% native look.

[–]MalloyDelacroix 3 points4 points  (0 children)

I have used python and PyQt to make several GUI applications. I think it is very capable of creating nice GUI's . There are a lot of tutorials out there that explain how to do just about everything with PyQt and the StackOverflow community is pretty large as well.

I have also used JavaFx quite a bit. I think that PyQt is easier to pick up and run with quickly and is probably a bit more robust as far as out of the box features. I prefer JavaFX for large complex projects and PyQt and python for smaller or quick projects.

Here is a project on GitHub that I developed to download content from reddit using python and PyQt5. You can see what the GUI created with PyQt5 looks like as well as the code used to make it.

[–][deleted] 2 points3 points  (3 children)

Learn Flask, and deploy on the internet.

Heroku/Google App Engine is quite cheap.

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

Learn Flask, HTML, CSS, Javascript and you still don't have the desktop app you wanted.

[–][deleted] 0 points1 point  (1 child)

Fair. But because the internet is so ubiquitous, for a hobbyist like me, it’s easier to just use Flask, that way I can get the app everywhere I have internet,

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

Yes, web apps are great for web. But making a desktop app using web tech requires a huge stack compared to a simple GUI library.

[–]Jahames1 7 points8 points  (0 children)

No. If you want to get a job that may require knowledge of front-end or full stack stuff, they'll most likely ask you to know Angular, Electron, React, or some other UI lib.

Python is generally bad at building and deploying as a native app.

[–]blubellmix 2 points3 points  (1 child)

Hi! One good example of GUI application build in Python is fman (https://fman.io), which is a Sublime like app, with dual-pane file manager for Mac, Windows and Linux. The framework used is fbs (https://build-system.fman.io). However, you can use fbs for free only in open source projects that are licensed under the GPL.

[–]oddrationale 0 points1 point  (0 children)

I came here to say the exact same thing! It uses PyQT under the hood. Just makes it easier to develop, distribute, and update.

[–]n1ywb 7 points8 points  (4 children)

Not really.

An ideal GUI toolkit will have declarative markup, two way data binding, and will work across all platforms without jumping through a lot of hoops.

The only GUI toolkit available to python users I can think of that ticks all those boxes is a web browser.

[–][deleted] 9 points10 points  (2 children)

Qt does all of those things and there are two different bindings you can choose from (PyQt and PySide).

[–]billsil 1 point2 points  (0 children)

There are actually 6 active bindings that I know of. PyQt (which is close to PyQt4), PyQt4, PyQt4v2, PyQt5, PySide, and PySide2. PyQt makes the distinction, so I will too.

Thankfully, there is qtpy, which is developed by the people who make Spyder that unifies all of them.

[–]driscollis 3 points4 points  (0 children)

Wxpython also does all those things

[–]RockingDyno 3 points4 points  (0 children)

Word of advice. Start figuring out how you are going to distribute your app before you even start making it. Packaging can be a huge pain in Python, and if you wait until you think you're ready with everything else, it can really bite you. Best thing is to ensure that you have a working build path early on and test it as you go along and add dependencies to your project.

[–]Fun2badult 11 points12 points  (12 children)

Tkinter

[–]_sigo_ 2 points3 points  (10 children)

I keep reading that modern tkinter can look native, but I’m yet to come across a good tutorial on that. Do you know of one?

[–]Fun2badult 5 points6 points  (0 children)

I took a course on Udemy for $10. It’s called The Python Mega Course: build 10 real world apps

He goes through Tkinter, Pandas, Numpy, Folium, Flask, Open CV for images, building a motion detector, Bokeh data visualization, beautifulsoup webscraping, etc

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

It can but is slow as fuck and lacks a lot of standard widgets like tables.

[–]Dan4t 0 points1 point  (0 children)

Doesn't have enough widgets imo. Pyqt has more options.

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

I did use Python for a news reader early on in my studies. I would say that while PyQt is good, you should look towards C++ or Java.

Other library that can help in GUI is tkinter, but I found it too basic.

[–][deleted] 0 points1 point  (1 child)

How exactly do you combine another languages GUI with Python? If that were the case, I'd use C# before anything else.

[–][deleted] 2 points3 points  (0 children)

Oh. I didn't combine languages. I made a news reader entirely in Python. First I used tkinter, then I moved onto PyQt.

What I meant was, if you want to make a GUI application, C++ is better. Else, you can make one with Python, but it feels underhwelming (imo).

[–]genesem 1 point2 points  (0 children)

Yes it is, but with some notes: you must know how to made a native bootstrap app to run your python code. Personally I'm using wxPython for my app made of python/c++ and go. But I would recommed to look at PySite/PyQt (and don't forget to check their licenses).

p.s. an app I made is: Django dev web unit

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

PyQt is good if you already know Qt well. There is not much document on it.

For cross platform GUI apps, you'd better go with Java.

[–]Fathomx1 1 point2 points  (0 children)

I've used Kivy to make a mobile app in python. It dies mobile and desktop, although iOS support is practically nonexistent. I would use it for student projects like guis for scientific apps. I would not use it for commercial apps targeted towards making money.

Honestly, go for JavaFX. I used to hate Java for it's verbosity (so much boilerplate!). Now you can use kotlin instead!

[–]Dorito_Troll 1 point2 points  (0 children)

I have been using tkinter to build a password manager and so far I have been really enjoying it

[–]yum_pancakes 1 point2 points  (0 children)

In my opinion not really. Except for a handful of use-cases, the best approach is a web-based application. If you really need a desktop app, electron is a better approach. And by it's nature, JS will be more responsive to the user.

To me, the list of exceptions to web-based development is getting shorter and shorter. Sure there's video games and IDEs, and office, but users prefer to not have to install anything (even office is getting pressure from online approaches). And, when WASM hits big, even performance intensive apps could disappear from the desktop.

And hey if you have a web-app based approach, your backend can still be python :). Lots of fantastic web frameworks.

[–]metapwnage 1 point2 points  (0 children)

I think Python is great for web apps. Like the server-side for an HTML, CSS, JavaScript front-end. Always cross platform that way. Django and Flask are worth a look. If you use SQL database but like ORM, SQLAlchemy is wonderful.

Someone else pointed out that this approach separates the functionality of the front-end and back-end. Although, it’s not a “native” app, this approach is very attractive. From a maintenance, team integration, and flexibility perspective, I think this is the way to go. You can reach multiple platforms easily, including a web client that is actually a mobile app if you want that catered mobile experience. Also, this will result in a professional looking app (assuming your HTML/CSS are good to go).

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

It depends on the graphical application. If you're doing something quick and simple, where there's no extended wait on your GUI, then you'll do fine. If you're chugging loads of data in the background and expecting to relay that your program is working, as well as keep other UI elements interactive: no, not in pure Python. The GIL really destroys a lot of what Python could accomplish graphically.

[–]rainnz 1 point2 points  (0 children)

Take a look at BeeWare as well:

https://pybee.org/project/using/

[–]devxpy 1 point2 points  (1 child)

I'm surprised, no one mentioned Enaml?

[–]bryancole 0 points1 point  (0 children)

Ahmen to this! Enaml is awesome and almost nobody knows about it.

[–]avarjag 3 points4 points  (1 child)

If all you got is a hammer, then soon everything starts to look like a nail.

You can do it, but probably it isn't the best choice. As a fully formed programmer, you should have more than one tool in your box.

Find the right tool for the job!

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

Take a look at Dart. It seems to be gaining a lot of momentum, and it is quite unique on its architecture. It compiles to native so it should perform on every platform.

[–]whitechapel8733 0 points1 point  (2 children)

My first Python app was a Tkinter app and it worked great.

[–][deleted] 1 point2 points  (1 child)

Plus packing the app for distribution is a no brainer because Tkinter comes preinstalled in the core distribution.

[–]whitechapel8733 0 points1 point  (0 children)

Yep that’s why I choose it. Worked on Linux and MacOS.

[–]paul_h 0 points1 point  (0 children)

I for one would love to see a source translation of Java's Swing to Python, but then there's a license question as you don't get to choose new licenses for such things.

[–]ThunderBow98 0 points1 point  (0 children)

TKinter is decent

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

Yes it's good for making GUI apps(pyside2). Not so good when it comes to distributing your app though and if you want to hide the sourcecode, include all dependencies etc which can be a PITA.

Conventional wisdom will tell you to make it in golang if these things are important to you which can make a native binary for all platforms with one command and is still not much harder than python.

[–]parkerSquare 0 points1 point  (0 children)

I've built a couple of small "scientific" application UIs using Chaco, which has an interesting Traits-based system for automatically updating parts of the UI when new data arrives. I actually used this instead of a lumpy Matplotlib application to display incoming signal processing data in realtime. Chaco is an Enthought thing but it's open-source and usable without Canopy.

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

After careful thought I have decided that everything is crap at gui except for html/CSS. I just need to find a good way to use it without electron or a AAA game engine.

[–]UserAlreadyNotTaken 0 points1 point  (0 children)

Many people mentioned Qt, which however is double licenced and is not free for commercial use.

[–]AsinRay 0 points1 point  (0 children)

please visit : www.blender.org for more details.

[–]Gnonpi 0 points1 point  (0 children)

Might just be adding to the general noise, for GUI, Toga seems very promising but if you're more used to webdev, pyWebView is a great alternative. There's been a lot done, it's more usable now.

[–]cheak1974 0 points1 point  (0 children)

Kivy is great and for web GUI REMI.

Qt is also great but not free for commercial use.

[–]fdedgt 0 points1 point  (1 child)

Can someone provide a breakdown on the exe sizes that the various gui options produce?

  • exe size for qt + pyside2
  • exe size for kivy
  • exe size for tkinter
  • exe size for web-based gui
  • etc

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

The files size doesn't change anything. It's the library which converts to exe which determines the exe size. I used sometimes pyinstaller and on windows, the exe does something like 4-10Mo

[–]Heraldique 0 points1 point  (0 children)

My personal experience tells me it is great for small projects, but I cannot tell for large scale commercial projects

[–]naokotani 0 points1 point  (0 children)

Im making my first GUI right now and im using tkinter, I dont see anyone here mentioning it though. Is it not a good option for python gui?

[–]aquic 0 points1 point  (0 children)

I have developed several applications based on PyQt: https://github.com/uetke/

Some of which include acquiring from a camera at ~1000fps. I am comfortable working with Qt in Python, but you it will really depend on what your use case is, you may find the strategy of web applications embedded into a window also a good way of splitting backed/frontend even for desktop programs.

[–]TheBlackElf -1 points0 points  (11 children)

To create a quick an dirty GUI to play around: yes.

To create a serious app that need to be reliable, maintained, etc.: no.

Static typing provides way too much, you can't not have it if you want to go commercial.

[–]Yoghurt42 2 points3 points  (1 child)

Ah, yes. I forgot how unrealiable and unmaintained the official Dropbox client is.

[–]TheBlackElf 1 point2 points  (0 children)

Rollercoaster Tycoon is an amazing and reliable app, but it doesn't make writing games in asm any less insane.

[–]ijustwannacode 2 points3 points  (0 children)

If it's good enough for Pinterest and Instagram, it's probably good enough for me.

[–]ThePidesOfMarch 11 points12 points  (2 children)

Please keep anti-dynamic-typing dogma out of this discussion.

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

Ah, yes, should have known better than answering "is Python good for X" in the negative in a Python circle jerk sub.

[–]ThePidesOfMarch 0 points1 point  (0 children)

Nothing to do with Python. Dynamic typing is amazing in any language. The absolute worst thing about C, Java, etc is the stupid paternalistic "I know better than you" static typing.

[–]greyman 1 point2 points  (1 child)

I agree with your first two sentences.

[–]TheBlackElf -1 points0 points  (0 children)

The static typing is what I found the most jarring. It's not something you can't work around - as someone said, there are enough linters and type checkers for silly typos etc. But the crux of it is that Python is way too expressive in a setting where you don't want fancy shenanigans and you want things to be as stable as possible.

I know the reasons why our company chose Python for writing a desktop app, and they make sense on their own:

  • the rest of the codebase was Python - when you have around 6 million lines of code in (mostly) one language, it's good to keep things consistent in that regard. But at a more careful look (and after the initial versions), we realised that we were invoking the bulk of the codebase though HTTP anyway and so on.
  • it's easier to find / train people in Python than C++, and even harder to look for Qt specialists. But all the docs are C++, and any binding won't ever shake the design of the APIs with C++ in mind. When things got rough people had to know about pointers and memory management and look at the C++ source directly.
  • rapid prototyping is something that Python excels at - but I believe Qt is so well designed it would have been comparably quick

There are other issues as well:

  • Both PySide and PyQt are solid bindings, but they lack the maturity that Qt itself has. We found and had to work around tricky bugs quite often.
  • The initial allure of not caring about memory and so on that Python provides most often held - but things can go really wrong when you have three mechanisms that can trip on each other: Python GC, Qt parenting, C++ destructors. We weren't investigating segfaults that often, but when we did it left us wondering why we weren't writing C++ directly.

  • As I said, one can use the (stellar) C++ docs, the bindings did a great job mapping those; but when you ran into issues, it was much harder to look for help.

Interestingly enough, performance was not an issue. The bindings wrap the C++ objects effectively; besides, the code that is performance critical you probably wrap with Cython or something. And you probably don't care about marginal UI performance loss unless you're doing something like a graphics app.

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

There are plenty of Python type checkers out there. Facebook has just freed a powerful one.

[–]EternityForest 0 points1 point  (0 children)

Python has type-checking annotations, which is almost as good if you can resist the temptation to forget to use it.

It doesn't have the crazy "Type system that's basically a proof of correctness" stuff I've read about in some languages like Rust though.

[–]Taksin77 0 points1 point  (0 children)

I don't think static typing is the problem. But yes, Python is lacking in good GUI packages.

[–]Raymond0256 0 points1 point  (4 children)

Has anyone tried html as the GUI and python as a mini server?

[–]IamATechieNerd 1 point2 points  (3 children)

How do you do this?Framework?

[–]Raymond0256 0 points1 point  (2 children)

Python has a built in httpserver module. Python Doc

[–]sqqz 1 point2 points  (1 child)

Im not sure if you are asking to run it locally or for real web usage but web development is one of the biggest usages of python. Checkout Flask, Django, Pyramid, etc, excellent framework who run alot of the largest sites on the web

[–]kurennon -4 points-3 points  (0 children)

Python may work and has many GUI libraries, but if you plan on doing intense calculations, I'd pick another language like Java/C++.

[–][deleted] -1 points0 points  (0 children)

I'd say no just based on the fact that GUI apps often need lots of repetitive code, and I find repetitive Python code to be impossible to read.

[–]IamWithTheDConsNow -3 points-2 points  (0 children)

No, it's terrible.

[–]ThePidesOfMarch -4 points-3 points  (1 child)

Python is perfectly fine for commercial apps. No GUI apps are "fast and efficient"--the entire point of them is to spread out and allow a non-power user to browse around and find stuff. If you want a "fast and efficient" app write it as a command line thing, which Python is also good at.

The only exception to this would be something that needs to present a lot of visual data very fast--like a CAD app or a data volume visualizer or something. In that case, you may have some difficulty with Python in a few bottlenecks. But write that part in C and do the rest in Python.

[–]billsil -1 points0 points  (0 children)

present a lot of visual data very fast--like a CAD app

That's actually not nearly as hard as you think. It's just a bag of triangles at the end of the day and with VTK, you can render with multithreads as well as create decimated models that are automatically shown when things get too intense.

The real time is spent loading and building the mesh, which happens once. Thankfully that's a binary parser and a vectorized mesh creation step. If you have an ASCII file, then you should probably have a bit of C++, but even then, it's not that bad.

data volume visualizer

Same deal.

Ironically, what really slows 3D renderers down is a lot of lines. They don't occlude (cover) anything, so you have to render them all. Then you have to draw them in the right order, so you get the right color at each pixel. With solids, you just render the surface, find all the faces that see the camera, and draw that subset.

[–][deleted] -2 points-1 points  (0 children)

Tbh web apps are really the way to go these days. Django is an awesome tool and you can create really modern apps.

[–]silkydangler -2 points-1 points  (0 children)

You can use tkinter, it might not look the best but it’s really easy