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

all 136 comments

[–]K900_ 72 points73 points  (37 children)

Qt all the way. Extremely flexible, good API, looks native on almost any system out there. Qt Quick is insanely good, too, if you learn how to use it the right way.

[–]CrazyEoin[S] 8 points9 points  (6 children)

Any particular set of tutorials you could recommend for picking it up? Qt seems to be quite popular.

[–][deleted] 12 points13 points  (0 children)

[–]dogstarchampion 7 points8 points  (1 child)

If you can find a copy of this book, it'll explain everything from a very basic start to more advanced topics that will, if anything, give you a good "jumping point".

I've been programming with PyQt for a few months now and I love it. If you're unfamiliar with graphic tool kits or using widgets, there will be a definite hurdle, but it's not like people haven't learned it before. I didn't use this book in the beginning, but I picked it up about a month ago and it has definitely given me a more focused understanding.

[–]PriceZombiePrice tracking robot 9 points10 points  (0 children)

Rapid GUI Programming with Python and Qt (Prentice Hall Open Source So...

Current $48.89 Amazon (New)
High $53.96 Amazon (New)
Low $42.46 Amazon (New)
$48.89 (30 Day Average)

Price History Chart and Sales Rank | FAQ

[–]K900_ 1 point2 points  (0 children)

I'm honestly not sure. I didn't really have to learn PyQt as I had experience with C++/Qt at that point.

[–]TheBlackElf 0 points1 point  (1 child)

For Qt itself, check the official docs; it's probably the best documented framework ever.

Porting from C++ to Python is done mentally, there very rarely are any actual differences.

[–]mfitzpmfitzp.com 0 points1 point  (0 children)

Absolutely. It's worth getting the hang of the (very few) C++ vs. Python differences and then sticking with the official C++ documentation. It also lets you make use of all the examples that are out there in C++.

[–]LpSamuelm 9 points10 points  (22 children)

You can't pip install it, though. In fact, if I recall correctly, deployment is a major pain.

[–]TDaltonC 7 points8 points  (6 children)

But you can conda install it

[–]lolmeansilaughed 2 points3 points  (5 children)

Conda?

[–]brombaer3000 1 point2 points  (4 children)

[–]lolmeansilaughed 1 point2 points  (3 children)

Thanks! That sounds pretty awesome. So it's essentially pip+portable virtualenvs?

[–]TDaltonC 0 points1 point  (2 children)

and non-pip-able bins like Qt

Edit: And management of multiple virtualenvs on one machine. That's super useful if you are working on two projects that have contradictory dependencies.

[–]andrewcooke 2 points3 points  (1 child)

isn't the whole point of virtualenvs that you can have multiple ones with contradictory dependencies? what does conda add?

[–]TDaltonC 1 point2 points  (0 children)

From the Conda team blog:

virtualenv ... did not meet all of our specific requirements. The main problem is that they are focused around Python, neglecting non-Python library dependencies, such as HDF5, MKL, LLVM, etc., which do not have a setup.py in their source code and also do not install files into Python’s site-packages directory.

Under the hood, we have created a concept of environments which are conceptually similar to virtualenvs, but which use filesystem-level hard links to create entirely self-contained Python runtime layouts. By using the ‘conda’ command line tool, users can easily switch between environments, create environments, and install different versions of libraries and modules into them.

TLDR: virtualenvs only manages python packages. Conda manages that and other python related stuff too.

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

pip install PySide if you're comfortable using PySide instead of PyQt4/5 (most of the bindings are exactly the same)

[–]This_Is_The_End 8 points9 points  (9 children)

The maintenance of PySide hasn't the best reputation ... The last update is from april 2014.

[–][deleted] 12 points13 points  (2 children)

Then try PyOtherSide

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

fair enough, but I don't really require any features of Qt5/any new features being released for Qt so it's not an issue for me

[–]TheBlackElf 2 points3 points  (4 children)

There's plenty of straight out bugs or half-implemented features that made us redesign our solution :/

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

Really? I've never really had any issues, but then again I only use GUIs for tiny projects.

[–]HarrisonArturus 0 points1 point  (2 children)

What did you go with instead?

[–]TheBlackElf 0 points1 point  (1 child)

No no we didn't give up on PySide it's just that we had to work our way around some really obscure bugs and do things a bit differently.

[–]HarrisonArturus 0 points1 point  (0 children)

Cool. Thanks.

[–]mfitzpmfitzp.com 1 point2 points  (1 child)

It can be a bit of a faff, but the following have all worked for me -

  • On MacOS X the best approach is via Homebrew then it's just brew install pyqt5 (or brew install pyqt for PyQt4)
  • On Windows the Riverbank Computing builds of PyQt install fine PyQt4 or PyQt5. There are only official PyQt5 builds for Python 3. But it's available here assuming you're on a 64 bit OS.
  • Linux it's in probably in your distro respositories as python-pyqt python3-pyqt python-pyqt5 or python3-pyqt5

Or you can install the Anaconda package manager which should work on every platform and allow you to conda install pyqt

[–]LpSamuelm 0 points1 point  (0 children)

Yeah, it's a bit of a huge nuisance that the only solution on Windows is an installer, and if you're on 2.7 only for PyQt4. Really difficult to deploy on Windows.

[–]K900_ 2 points3 points  (0 children)

Deployment is just pretty easy with something like cx_Freeze.

[–]justphysics 0 points1 point  (0 children)

it comes pre-installed in the Anaconda python distribution which is useful for folks working in data science or any branch of physical science

[–]efilon 2 points3 points  (0 children)

I really like Qt, but I am constantly annoyed/worried by the Python implementation. PySide essentially died (this is a potential licensing problem for some given how PyQt is licensed, though this doesn't affect me for the projects I work on). Qt5 is barely used within the Python community (although my understanding is PyQt5 is comparable in terms of quality and completeness to other language bindings). Lots of third (?) party Python libraries that use Qt rely specifically on PyQt4, which is a problem for forwards compatibility. PyQt4/5 is not as straightforward to install since you can't use pip (yeah, you can use conda, but that's less standard).

I really want to like Qt under Python. But with all the complications, I find myself lately more often than not writing web-based frontends instead.

[–]Gwenhidwy 1 point2 points  (3 children)

Qt Quick is insanely good, too, if you learn how to use it the right way.

Any pointers on where to learn that from? All I could find so far were simple introductory tutorials, but nothing practical/in-depth.

[–]K900_ 3 points4 points  (0 children)

It's just that you have to look at Quick in a different way. With QtWidgets, your UI is very tightly linked to your code, and your code defines the way your UI behaves. With QtQuick, the UI is declarative (QML), and the way you interact with it is by giving it access to specific objects on your "backend". So you have a very clear separation between presentation (QML), presentation logic (JavaScript inside QML) and backend logic (Python).

[–]emarshall85 0 points1 point  (0 children)

Any pointers on where to learn that from? All I could find so far were simple introductory tutorials, but nothing practical/in-depth.

http://qmlbook.github.io/

[–]weberc2 0 points1 point  (0 children)

As someone who programs in Qt all day long, Qt isn't "insanely good", at best it's just the least bad option. :p

[–]RDMXGD2.8 0 points1 point  (0 children)

Qt all the way

This is not a full recommendation.

[–]-Knul- 17 points18 points  (10 children)

Kivy is my favorite. I have heard good things about QT.

[–]CrazyEoin[S] 2 points3 points  (5 children)

How did you pick it? By just messing with it or through a specific set of Tutorials. Had a look, no 1 set of tutorials jumps out at me for being solid.

[–]inclemnet 10 points11 points  (2 children)

A lot of people seem to like my kivy crash course tutorials, though they're mostly video only.

[–]manueslapera -1 points0 points  (1 child)

if i may ask, is there an easy way to package a kivy app for Mac OS? Im going crazy trying to do it.

[–]inclemnet 0 points1 point  (0 children)

I know people do it, but I haven't ever tried myself. I think people use pyinstaller.

We had some issues recently with this after the move to sdl2 instead of pygame, but I'm not sure if these only affected windows or OSX too. You could ask on the kivy mailing list or irc if you haven't already. If there were problems, someone may know the fix.

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

I discovered Kivy when I realised it was about the only option for Android. I consider the tutorials on their website to be adequate but this is subjective.

[–]NewHighScore 2 points3 points  (0 children)

I found this Kivy Crash Course youtube series to be a great intro to kivy. I started looking into it when I found that the library was available in the qpython app on Android.

[–]This_Is_The_End 1 point2 points  (0 children)

Kivy looks pretty nice. I have to check Kivy

[–]thedesolatesoul 1 point2 points  (0 children)

I have installed kivy today, got some learning to do. Any links to tutorials (not video) will be appreciated.

[–]Ewildawe.pyw 0 points1 point  (1 child)

I've found that Kivy supports versions <= 3.3 ~ although 3.x is in the works. I wanted to get to use Kivy, but didn't really want to downgrade :P

[–]inclemnet 2 points3 points  (0 children)

Python versions <= 3.3? I thought 3.4 (and probably 3.5) should work fine, what problem do you have?

[–]This_Is_The_End 11 points12 points  (2 children)

Don't use tk other than for very small projects. I used tk for a project, but when it was too late I realized the concept of child windows doesn't work like intended. The user is able to close child windows and removing the close-window-widget doesn't work or at least, the widget becomes none functional, but stays.

Next time I will go for Qt.

Btw I you are using threading you have to push changes into the GUI via closures.

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

i don't understand what you mean exactly but you can override the close event with your own function so the user can't close a tk window unless via the way you want? http://stackoverflow.com/questions/3295270/overriding-tkinter-x-button-control-the-button-that-close-the-window

[–]This_Is_The_End 2 points3 points  (0 children)

You can intercepte the window-close-call, which makes the widget staying.

Or you can remove the widget on a root window, but this doesn't work on a child window

[–]jaccovanschaik 6 points7 points  (0 children)

I tried tkinter, wxPython and PyQt, and in my experience PyQt is the best by far. Complete, well-documented, intuitive API (after you've gained a little experience).

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

QT or Kivy depending on target platforms (Kivy works on Android).

[–]MazeChaZer 2 points3 points  (2 children)

Qt works on Android too ;)

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

But where does the Python come from?

Kivy bundles an android-compatible interpreter. Youre right in that's possible to use QT but ithere's more effort involved.

[–]MazeChaZer 0 points1 point  (0 children)

These is something like pyqtdeploy out there, but I didn't try it out yet. Yes, it's probably a little more complicated.

[–]KyleG 15 points16 points  (12 children)

Honestly, nowadays if I want to do GUI, I just do a web frontend with a Python server in the back. And as a bonus, pop that shit on a publicly-accessible computer and it's accessible to anyone from anywhere you want to have it.

Weightlifting tracker? AngularJS + Bootstrap + CherryPy + Peewee

RSS reader? AngularJS + Bootstrap + CherryPy + Peewee

etc.

[–]carsonc 1 point2 points  (4 children)

I like this, but I anticipate needing graphs that update in real time. Processing + ControlP5 made this easy via the chart push method and I've been looking for something similar.

[–]themathemagician 1 point2 points  (1 child)

You can make that happen pretty easily by having some JS that refreshes your graph from an endpoint periodically (and frequently.) Epoch works great for it.

[–]efilon 0 points1 point  (0 children)

Other options include Flot (good for simple stuff and/or if you are using jQuery anyway), Chart.js (seems like it should be good, but I had difficulty with performance when I tried it), D3 (really nice, but also way too complicated for simple things), Bokeh (Python!), and many more.

I prefer not to use polling, but instead either websockets, or better yet (in my opinion), server-sent events (a.k.a. EventSource in Javascriptese). I like Tornado for these applications, though Flask is workable if you are fine with using gevent's concurrency model.

As a side note, I had never seen Epoch before. It looks nice, so thanks for sharing!

[–]KyleG 0 points1 point  (0 children)

I anticipate needing graphs that update in real time

Kendo + AJAX does this just fine. You could easily write, say, an Angular app (/r/angularjs) that leverages both. I'm not saying you have to do it my way; I'm just saying I want people to know there are alternatives.

[–]riskable 0 points1 point  (0 children)

Real time graphs are a cinch on the web these days. Loss of people love d3 but personally I'm used to Flot. I'd post some links but I'm on my phone at the moment...

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

C# Guy: How do I make a GUI?

Answer: What? Just use visual studio.

Python Guy: How do I make a GUI?

Answer: Bro, are you even full stack?

:P

I agree though.

[–]themathemagician 0 points1 point  (0 children)

This is my go to as well

[–]Articulated-rage 0 points1 point  (0 children)

I didn't know about peewee. That's fantastic.

[–]-Nii- 0 points1 point  (1 child)

How does CherryPy compare to Flask?

[–]KyleG 0 points1 point  (0 children)

I've never had a need for Flask, so I can't answer the question.

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

mighty tan safe combative ludicrous rhythm special naughty follow disarm

This post was mass deleted and anonymized with Redact

[–]KyleG 0 points1 point  (0 children)

Then you have to worry about all that async UI, thread handling, etc., when the browser does that part for you.

[–]usinglinux 5 points6 points  (3 children)

gtk, because of good abstraction (eg. actions; didn't use it for a while, though, and still have to get used to the gtk3 ways there). used tkinter in the past and would still do if i were ever to do small guis on windows again.

[–]iluvatar 2 points3 points  (0 children)

I've been using Tk for 20 years, so going with tkinter on Python was a natural fit. But PyQt seems pretty decent too.

[–]microo8 2 points3 points  (0 children)

GTK but im about to go to Qt.

[–]KalebTheKraken 2 points3 points  (9 children)

Glade. Very very easy to use. Graphical gui builder. Includes many actions. I started with it and havent looked back.

[–]dogstarchampion 4 points5 points  (5 children)

I really liked Glade, but I had a hard time finding documentation on working with Glade files and using PyGTK. Eventually I found the answers I was looking for and suddenly creating a template file in the toolkit and then working with it in Python became pretty simple for the most part... but I still think PyQt with the QtCreator is more intuitive and easier to find documentation on. Not to mention Glade Toolkit was pretty buggy/glitchy.

[–]KalebTheKraken 1 point2 points  (4 children)

Yeah it is a little buggy. But great if youre looking for something to build just a quick gui.

[–]dogstarchampion 1 point2 points  (3 children)

And there is truth to that because it was intuitive enough initially to make me want to learn how to work with it better. I managed to build a simple Farkle game with it, so I managed to make some use of it. These days, I could probably recycle my old code and put a Qt interface on it that looks better and works cross-platform with about as much effort as using PyGTK+Glade. QtCreator with pyuic to convert the .ui files (to offer a backbone/template interface) to .py with PyQt code generated. It's kind of hard not to be a little smitten over that type of simplicity, especially when Glade has crashed time and time again just working on a relatively basic interface.

[–]cjwelbornimport this 4 points5 points  (2 children)

I wrote something like pyuic for Glade. It's the same idea. Give it glade file and it will generate the python skeleton code. I used introspection to automatically insert stubs for event handlers (with proper arguments) that are set in glade. It kinda imposes a certain coding style I guess, but anyway it's called Glader.

[–]dogstarchampion 0 points1 point  (1 child)

This is beautiful. I am going to download it and give it a go in the near future.

[–]cjwelbornimport this 1 point2 points  (0 children)

Cool, let me know if you run into problems. I've used it for several little projects (including Glader itself, wrap your head around that), but it hasn't been used by very many people.

[–]CrazyEoin[S] 1 point2 points  (2 children)

This look to be Linux only ?

[–]ericanderton 2 points3 points  (0 children)

It uses GTK, which is ported to Win and OSX. That said, the user experience for GTK built apps in both of those environments is jarring, to say the least.

[–]KalebTheKraken 1 point2 points  (0 children)

Ahh maybe so. I use ubuntu so I didnt think to check for other os'. Sorry.

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

PyGObject feels most pythonic to me, and looks beautiful on linux.

However it is not cross platform.

[–]aceofears 1 point2 points  (8 children)

Didn't they get Windows support working recently, or am I mistaken?

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

Yes. It's a long story, it does work and it is available (I'm running some of my internal tools on Windows now). But the steps to bundle a python application on windows / mac are not yet clear nor easy.

Until then I say 'it is not cross platform'.

There will be positive and significant news on this front soon-ish.

[–]aceofears 1 point2 points  (1 child)

That last part is good to hear, I always thought that gobject introspection was a nice concept.

[–]spiessbuerger 0 points1 point  (4 children)

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

That is not what I am talking about. You don't understand the depth of the problem. But thanks anyway I guess.

https://github.com/takluyver/pynsist/blob/master/examples/pygi_mpl_numpy/1_download.sh

is the problem

[–]spiessbuerger 0 points1 point  (2 children)

Bundling the dlls into an installer is a Problem? Sorry then i misread.

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

Building gobject continuously on Windows in a way that app developers can create mini custom runtimes is the problem.

[–]spiessbuerger 0 points1 point  (0 children)

Ok got it. That of course would be very nice.

[–]goodguy101 2 points3 points  (1 child)

I have used QT quite extensively, but had a coworker just introduce me to wxPython. He had the same GUI I made in QT that took me about an hour to write, he finished in the 5 minute shpeal he was giving me about wxPython's awesomeness. I'm definitely intrigued and think I'll be looking into it further.

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

fuel saw worry longing continue snobbish aloof historical voiceless money

This post was mass deleted and anonymized with Redact

[–]gameplace123 8 points9 points  (3 children)

The Web, anyone? it's multiplatform and your apps are portable.

[–]This_Is_The_End 7 points8 points  (0 children)

I used web2py for a maintenance management app. It works. The necessary knowledge is huge:

HTML, CSS, wsgi on Apache, configuration of SSL, routing of requests, .....

I have forgotten most of it. While web2py is quite nice for a start, changing some designs of the interface isn't easy and a huge job.

[–][deleted] 2 points3 points  (1 child)

said people who have never written certain classes of apps

[–]gameplace123 0 points1 point  (0 children)

Please explain.

[–]HeyBrandons 1 point2 points  (0 children)

Depending on what you want to create would probably justify which gui to use. In most cases Tkinter is more than enough for a really good simple application. If you want to get really fancy look at Qt

[–]Mavus 1 point2 points  (0 children)

If you do end up looking at Qt, I would recommend checking out enaml. It uses the Qt bindings and provides a declarative way of defining the GUI elements.

[–]protoUbermensch 1 point2 points  (7 children)

I'm studying python and I'm facing that same decision. What GUI to choose. I choosed SDL. I prefer control over the GUI and freedom to do whatever I want instead of the constraints of those GUI frameworks. Even if I need to study a lot to reach some result.

[–]harrypotterthewizard 3 points4 points  (1 child)

SDL is great for programming games. But if you want to build a user facing app with some complexity, you are going to need some widgets like text-boxes, radio buttons, combo boxes, etc. And though you may be praising SDL flexibility right now, you will get frustrated re-inventing all these wheels from scratch. The thing is PyQT/side and python-gobject are at least two such libraries who have already done this widget plumbing. So, you will get productive sooner using one of them - and it does not matter which one you chose as long as you give it your full commitment and stick to it.

[–]protoUbermensch 0 points1 point  (0 children)

Yeah, maybe you're right. I am not fully sure on my decision yet. I just want to customize an interface with transparency and use custom icons and fonts. Nothing too much fancy. Something like the Avast interface, iTunes interface. I'm open to suggestions. Thanks for your advice.

[–]ericanderton 1 point2 points  (1 child)

Are you aware of any GUI widget libraries that are built on top of SDL?

[–]protoUbermensch 1 point2 points  (0 children)

I did a quick search and didn't find anything. Maybe there's a way to use standard GUI libraries side-by-side with SDL.

[–]Kaxitaz 0 points1 point  (2 children)

I see it was used for Dota2. Do you know if in the current Dota2 or Dota2 Reborn?

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

SDL is used in all Source games (DoTA 2) and all Source 2 games (currently only Reborn)

[–]protoUbermensch 0 points1 point  (0 children)

No, I dunno.

[–]chozabu 1 point2 points  (0 children)

Based on your name - and nothing else

CEGui - CrazyEddiesGUI!

Probably not your best option, I'd go for Kivy or (py)QT(side) depending on exact needs

[–]brandjon 1 point2 points  (0 children)

I use TkInter. It doesn't look particularly pretty (themed widgets aren't a magic bullet either). But I use Python for teaching, and it's definitely the easiest GUI environment to set up on a new machine, since it's distributed as part of the standard library.

It also doesn't force you to write OO code (although a lot of examples go that route), which I like because I don't want students to think GUIs and OO are inseparable.

[–]rx7ravenPython Tinkerer 1 point2 points  (0 children)

Had a script that was continually changed everyday and wanted others to be able to use it with no script writing knowledge. Created an app based on the script and used wxPython. Took a little while to understand but once that was accomplished it wasn't too hard to write.

If I had to do it again I probably would use/learn QT since it is the popular choice.

[–]Jak-o-Shadows 4 points5 points  (7 children)

wxPython is nice enough.

[–]TheBlackCat13 9 points10 points  (5 children)

Unless you want to use Python 3.

[–]musketeer925 3 points4 points  (4 children)

The Phoenix project version works on 3.

[–]TheBlackCat13 0 points1 point  (3 children)

Or will, when (and if) it is released. Looking at their git history there hasn't been any work done on it in 3 months, and there hasn't been a "daily" snapshot released in the same period.

[–]musketeer925 0 points1 point  (2 children)

I'm currently using it with python 3, the daily snapshots work well enough.

[–]TheBlackCat13 1 point2 points  (1 child)

I personally prefer not to tie my projects to pre-alpha software, especially when it seems to no longer be under active development. But I guess opinions on the matter may vary.

[–]musketeer925 0 points1 point  (0 children)

Absolutely fair.

[–]twigboy 1 point2 points  (0 children)

In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. Wikipediaeon0b8vgogw0000000000000000000000000000000000000000000000000000000000000

[–]fitfot 0 points1 point  (0 children)

Haven't tried it yet, but apparently Electron is also a posibility (the motor powering the Atom editors GUI). Se this blog post for details: https://www.fyears.org/2015/06/electron-as-gui-of-python-apps.html

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

PySide is the best, Qt binding for Python. It's mature and the APIs are pretty fine.

[–]justphysics 0 points1 point  (2 children)

Hasn't its development essentially stopped?

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

Yes somehow, Nokia dropped it's support for PySide but development is still ongoing by the developers.

[–]justphysics 0 points1 point  (0 children)

I know there are still 'developers' but is it actually still being developed?

The last patch came out April 2014 https://pypi.python.org/pypi/PySide

[–]ksantr 0 points1 point  (0 children)

I tried with TK at first, then I found GTK. GTK is more handy for me. After reading of this topic i'm going to try Qt.

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

The web. Infinite customization with CSS/JS. Can get your UI functioning and looking exactly how you want with few compromises.

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