

Ask YC: Toolkit for python desktop applications - aitoehigie

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?
======
jauco
I believe wxPython is the one that's used most often. But most toolkits such
as QT and GTK have python bindings as well.

~~~
JesseAldridge
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 :)

~~~
JesseAldridge
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.

------
thorax
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...](http://www.ginstrom.com/scribbles/2008/02/26/python-gui-programming-
platforms-for-windows/)

~~~
JesseAldridge
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...

------
bdfh42
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.

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

~~~
bdfh42
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.

------
denimboy
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.

------
Erwin
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.

~~~
jcl
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>

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

~~~
jsrn
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...](http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#license)

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/>

~~~
jcl
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/>

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

------
kurtosis
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.

~~~
yummyfajitas
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.

------
khill
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.

------
flyingfred0
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.

------
kilowatt
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>

------
mattdennewitz
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.

------
aitoehigie
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?

~~~
avinashv
I think you want wxGlade.

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

------
newt0311
Mentioned before but pyGTK is also a good option.

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

