Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask YC: Toolkit for python desktop applications
34 points by aitoehigie on May 22, 2008 | hide | past | favorite | 32 comments
I am new in developing desktop applications in python (i.e. coming from a web applications background) and i want to know the best toolkit or framework to develop my desktop applications.I have heard of dabo,but are there any others?


I believe wxPython is the one that's used most often. But most toolkits such as QT and GTK have python bindings as well.


I've been using wxPython for about 6 months now, and I'm pretty happy with it. It has it's fair share of quirks to get used to, but then all powerful, cross-platfrom gui toolkits do. It's got a lot of really powerful widgets (there's one that renders simple html, there's one that wraps Scintilla, there's one that let's you use OpenGL, etc).

One really cool thing about it is it comes with a demo app that shows how to do almost anything -- how to use the widgets, how to use threads, how to handle events, etc.. It's basically a big collection of small programs. You can see the code in one tab and see the program in action in another tab. Here's a couple screenshots:

http://crookedgames.com/wx_python_demo_action.png

http://crookedgames.com/wx_python_demo_code.png

Yet another cool thing about it is Robin Dunn, its maintainer. He seems to go through the mailing list every day or two, and answers most questions that people have. He's been maintaining the project for a long time and knows what's up. Maybe I shouldn't be advertising him as tech support, but I've received helpful assistance from him more than once :)


Since writing this I've moved from wx to qt. I much prefer qt. It's faster, less buggy, and better documented. PyQt is definitely the way to go.

Just a note in case someone finds this via Google or whatever.


If you go the wxPython route, then there is wxGlade to make designing the interface easier. http://wxglade.sourceforge.net/


This is one of the better "first look" overviews that I've found for the various Python GUI toolkits: http://www.ginstrom.com/scribbles/2008/02/26/python-gui-prog...


This review lists one of the pros of Pyglet as having a "Large number of widgets". Yet it seems to me to just be an OpenGL wrapper / multimedia player. Am I missing something? A full fledged OpenGL based gui toolkit would be pretty cool...


For the Windows platform, you could always get a copy of "Programming Windows" by Charles Petzold and call the Win32 API directly (not really recommended). For a native Windows look I suppose that Iron Python would be optimal as it has full access to the .NET Framework.The Mono project has made that effectively portable to the other supported platforms but you would end up having to immerse yourself in the .NET world view.

Otherwise I get the impression that most other GUI kits for Python have a "look" of their own and are thus going to stand out a bit on any given platform.

I will certainly be tracking this post to see what suggestions come up - thanks for posting the question.


Another vote for the IronPython + Mono/.NET.

An added advantage is far faster runtimes thanks to bytecode-compilation (vs the default interpreted-code nature of Python in most circumstances).

You can write your code in Visual Studio on Windows or MonoDevelop on Linux. On Windows, it'll use the native Win32 controls, on Linux Mono will "draw" controls that look like the native ones without actually calling the native binaries - it allows for a huge compatibility boost and still manages to look 99% native (technically it's drawing the exact same native controls, but the drawings aren't perfect).


wxPython will create a native look and feel on Windows, Mac and Linux (by using the correct API for each)


thanks for your response but i am also thinking along the lines of platform portability.


Well the Mono project would make any Iron Python development portable to the Mac and Linux and would certainly meet your "Windows Forms" type requirement. Still, there are alternatives being suggested on this post that could meet the need by supplying just the GUI components.


You might want to check out pythoncard http://pythoncard.sourceforge.net/ at least for prototyping. It uses wxPython as the windowing toolkit. It has its own GUI builder built in pythoncard itself.

pythoncard is like hypercard but it has all the power of python behind it. I have used it to write little desktop apps and been quite happy with the ease of development (particularly when adding new features after some months) and the performance. I never tried making an exe, but it should be possible.


I've had good sucess with pyqt in a commercial setting. We paid a student programmer to develop our application and he had good Python but little pyqt/qt knowledge. We were able to develop under Linux and deploy to Windows with minimal compatiblity tweaks and in short time. Buliding an installer that bundled python/pyqt etc. was easy.

We used pyqt3 for which you could buy a pyqt-only commercial license (I think $300, cheaper than the maybe $1500 full QT license). I'm not sure what the situation with pyqt4 is. The price is per developer. I don't know the current pricing because that's apparnetly impossible to find on the QT site.

If I had to pay the full price today, I would still do it (speaking as a commercial developer that is) -- it's really a high quality toolkit.

I think dabo is higher level than pyqt is though Qt also has various ways to integrate database data sources into your views. I don't know how important that is to you.


I'm not sure if things may have been different with PyQt3, but the current version requires you to buy a PyQt license (~$700 USD) in addition to a full Qt license from TrollTech.

http://www.riverbankcomputing.com/commercial/buy


Have you looked into pyQT? At least that will allow your app to run on Mac, Windows and Linux!


it should be mentioned that pyQT requires you to choose either GPL as the licence for your software, or purchase a commericial QT licence.

http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4r...

If you don't like that (for example, you don't want to distribute your code as mandated by the GPL but don't want to pay for QT), another good platform-independent GUI toolkit is wxPython:

http://wxpython.org/


Seconded. The QT licensing is actually more restrictive than other dual-licensing schemes: TrollTech will not allow you to start developing your application with a free version (including the ones distributed with Linux), then switch to a commercial license later. In other words, if you think there is any chance you'd want to distribute any of your application's code under a non-GPL license, you need to get a QT commercial license before a line of code is written.

http://trolltech.com/developer/knowledgebase/182/


One caveat on this: I believe you can get a 30 day trial of the commercial version.


PyQt all the way! Both for my hired gun projects (WengoPhone, QuteCom) and for my personal projects. The UI toolkit (QtGui) is great: the widgets have a native look and feel on all platforms (deal breaker otherwise for me), you have an good UI designer etc. But Qt has more libs! File parsers, a signal/slot library for asynchronous calls (which you pretty much have to use with QtGui).


will check it out.


I've found enthought's Traits to be very helpful. It's a MVC framework that can save you from sinking lots of time into writing tedious boilerplate. For anything it doesn't handle automatically, you can write using wxPython. It's a little sparse on the documentation so you'll spend a lot of time looking at the source code to figure our how things work though. They also claim that it's portable but I haven't tried it on anything other than linux.


I haven't tried the Trait's gui, but I highly recommend the rest of the library. It lets you do all sorts of OOP tricks; validation of assignments, delegation, etc. Very much worth checking out.


For cross-platform development, wxpython is great. It's a nice library and I've used it to make apps which run well on Windows, Mac, and Linux.

I've used pyQT for QT and KDE applications and I enjoy it very much. It's nice to be able to use QT Designer to quickly build windows and application panels and then use pyuic to generate the python code.


As some of the other comments have suggested, wxPython is a good choice. It attempts to wrap the native controls where possible, so your app won't look too out of place on any one platform.

For creating your form layout without code, there is the included XRC editor, which allows you to create dialogs, panels, menus, toolbars, etc. and save those as XML files, which can be loaded and displayed by your application code.

http://wiki.wxpython.org/XRCTutorial

Regardless of how you create you GUI in wxPython, make sure you have a basic understanding of how sizers work to layout your application.


i wrote a little xml-rpc application using twisted and wxPython that sat behind a full-screen flash kiosk and stored results in a sqlite db. the interface was just a couple of buttons (roughly, "dump db to csv file" and "stop server and exit") and a count in the status bar -- couldn't have been easier to make w/ wx and compiled to a win32 executable very easily w/ py2exe. twisted has some sweet tools for integrating w/ wx that make network stuff a breeze, too.


Despite some of its unpythonic style, I like wxPython, because it uses native widgets everywhere. This is a huge advantage over every other toolkit, in my opinion.

Right now I'm experimenting with on an alternative to wxPython called wxpy using a forked version of the SIP bindings generator, instead of SWIG, to see if I can eek out more performance and bring down the memory usage:

http://github.com/kevinw/wxpy/wikis


I forgot to add this, is there a framework or toolkit that i can use to develop something like windows forms? without writing the code?


I think you want wxGlade.


Or Stetic.


I've had good results with Tkinter. The widgets look native enough on Win32, and it's supposedly pretty portable.


Mentioned before but pyGTK is also a good option.


I second that. PyGtk with Glade is the easiest way I've found of cranking out a GUI quickly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: