Python for professsional Windows GUI apps?
apt.shansen at gmail.com
Mon Aug 24 17:49:36 CEST 2009
> I was wondering if some people in this ng use Python and some GUI
> toolkit (PyWin32, wxWidgets, QT, etc.) to build professional
> applications, and if yes, what it's like, the pros and cons, etc.
My company does. A few years ago we decided to re-write our entire aging
product line in Python using wxPython as the GUI layer (PyWin32 was out
because we wanted Mac compatibility, and at that time between QT's
commercial license and my own familiarity with wx meant we just used that by
It took some time to get solid; there's a learning curve involved in doing
things "the pythonic way", and wxPython is -- not really pythonic(and no
powerful GUI library is, though there are some simpler libraries out there
which are), so you're learning in two directions at once.
It's been a pretty interesting experience, and I'd consider it a complete
success, honestly. It took some time to get the full suite going from
"functional" to "mature", mostly because of certain complexities to our
system which have nothing to do with Python. But, Python and wxPython as the
foundation for the system has allowed some pretty remarkable flexibility in
getting something usable to the customer quickly, getting early feedback and
rapidly responding to their needs and growing the application as we did so.
It's been a very iterative process, but I don't know if you want to create a
long-term project or get something out that works Just Fine, Right Now. For
us we started out with a basic re-implementation of the legacy system which
just 'worked', and have over the last few years probably rewritten most of
the original code at least twice (a piece at a time)-- re-factoring and
redesigning both the insides and UI as new controls and technologies (and
our own knowledge!) improve over time. For us that's good, because we like
maintenance contracts :)
But we've had a continually evolving product line-- getting faster with
every new release, slicker, with new features and evolving continually.
Sure, every program /should/ do that -- but using Python+wxPython IMHO has
been invaluable to the process of evolving /efficiently/. It takes very
little effort to /maintain/ the system, very little effort going back to
some deep dark place in the codebase and figuring out what the heck was done
by someone else three years ago... and very little effort to pull the whole
thing apart and piece it back together with a new heart when it's discovered
the original didn't quite do things as well as it should.
I'm especially concerned about the lack of controls, the lack of
> updates (lots of controls in wxWidgets are 1.0 deadware),
I find this comment -- frankly bizarre.
There's a plethora if controls in wxWidgets, and it's not terribly hard once
you learn the system how to make your own. Check out Andrea Gavana's
excellent suite of custom widgets (which continually get migrated into the
core wxPython) and the AUI, and the sublime ObjectListView for Python.
Now, if you're talking about "lack of the latest Microsoft-specialized
controls", that's true. wxWidgets is cross-platform so doesn't readily adopt
the latest and newest way that Microsoft does things with each new iteration
of Office and Windows pumping out a new UI paradigm. But you can still
create very native and impressively functional looking apps.
With wxWidgets at least (I have no idea about QT), you also don't have a
series of data-aware controls that you may be used to, but it's *really* not
that hard to write that layer yourself.
You may also want to look into Dabo, which builds on top of wxPython and I
believe solves some of its limitations with regards to data-integration if
you do things in a way that are Dabo-esque. I'm only vaguely familiar with
Depending on your needs, you can use various dialog builders to create
XRC/XML "descriptions" of your interface and load them up-- but personally I
hand-code all the controls and interfaces, and doing so once you learn the
system is really quite rapid. I can dummy up a very functional interface for
testing/dummying much faster in Python/wxPython then I can in Visual Studio.
It doesn't have as many bells and whistles, but I really can't imagine why
anyone would find themselves control-starved.
> and problems
> linked to how to update users' PC remotely when I build a new version
> using eg. Py2exe.
What problems? Yes, you have to learn py2exe, but once you have your program
packaged together, it's no different then any other program on windows.
Build a MSI, and have the IT guy push that MSI out via an active directory
group policy. Isn't that the standard way you install and update /any/ group
of users' software on a windows network? Regardless of in what language you
write it in?
I need controls for business apps like access to databases, good data
> grid, printing reports (with or without barcodes), etc.
Data access is easy and well supported to a wide-variety of databases,
depending on just how you want to do it. I've recently fallen in love with
SQLAlchemy, though previously I did mostly simple DB-API based access and
home-grown model objects representing data models.
The wxWidgets "data grid" is somewhat somewhat lacking at present in that it
doesn't really connect "to" the database-- but it is not significantly hard
to write a table implementation to serve as your 'backend' to connect to the
database, which the grid can then uses to define what it shows. Dabo's grid
implementation solves that, I believe, so may be good for you.
Reports, I have no idea-- in my company's domain the reporting needs are
very limited, and we've found it sufficient to write out a HTML file and
toss up IE to print out the table. But there is reportlab which is an
excellent library for PDF generation -- and making reports in particular, of
course. It has support for barcodes, I believe.
Dabo also has some links to a report generator they include -- never really
looked in beyond glancing and going 'Oh, neat.'
P.S. I have no idea why I'm pumping Dabo so much in this though I've never
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list