This post originated from an RSS feed registered with Python Buzz
by Andrew Dalke.
Original Post: PythonCard and Boa Constructor not ready yet
Feed Title: Andrew Dalke's writings
Feed URL: http://www.dalkescientific.com/writings/diary/diary-rss.xml
Feed Description: Writings from the software side of bioinformatics and chemical informatics, with a heaping of Python thrown in for good measure.
A potential client asked me about a project today so I spent much of
the evening writing up a proposal and evaluating some of the
technology. They want to turn a simple algorithm into simple
application. There's two standard solutions: web-based or desktop.
The first is easy to whip together for this algorithm but it doesn't
provide good interactivity nor easy support for state. For example,
in a local app you can drag a parameter slider and see the effects
displayed immediately; if you want to try out a new data set, just
"File -> Open" and it's done. HTML doesn't even have a slider, and I
use Twisted/Zope/Quixote/etc. to help with server state but that means
a non-trivial server, which means getting IT involved, which means
more work for a deployment. (Java doesn't solve it because a few
(non-trivial!) libraries are only available in C++, so it would still
need a server component.)
A couple weeks ago, at SciPy, I saw that most projects were using
wxPython for the GUI. I had looked at it some three years ago and
wrote a simple chemistry app which talked ODBC to Daylight's Oracle
cartridge and used Synposys's Accord ActiveX control for the compound
display. (It's a really nice control, now sold by Accelerys.)
There were four problems I had with wxPython at the time: I needed to
do the GUI layout by hand, the startup time was too long, wxGrid
didn't let me have a sort arrows in the column header, and the APIs
still seemed unstable. I figured things must have improved over the
years so I looked to see if the GUI layout tools were good enough.
I tested the two most popular: PythonCard and Boa Constructor.
(There's also wxGlade. Any others?)
I did the 42 incr/decr example in the documentation and ran into a few
problems. If you change a value in the resource editor you need to
press the enter key or click on the "update" button for the change to
take place. I lost several edits that way. (It is nice, BTW, that as
you switch components, the property field stays selected on the same
name.)
I wanted to use the text "+1" and "-1" for the incr and decr buttons
but ended up changing the name field instead. Bad idea. That made
the component disappear from the layout window even though it remained
in the Property Editor with the changed name. "=90" seems to work?
In any case, the name is used as an Python attribute so there should
be a validator which enforces proper names.
There's no way to set the tab order. It uses the creation order, but
I got mine backwards. I suppose I could change this using wxPython
directly, but in Qt Designer this can be done in the GUI. There's no
way to select and move a set of components. There's no way to insert
an ActiveX control, except by writing wxPython code.
And there's no support for automatic layouts! Everything is
positioned abolutely, with no way to tell it how to expand when the
window resizes or the font changes. That makes it hard to have a
layout which looks good on multiple platforms. This is not a fault
with wxPython. The API supports all those features, and Qt Designer
and other builders show that it can be done using a GUI. But it isn't
in PythonCard.
I then tried out Boa Constructor. After being overwhelmed with the
number of controls on the screen, I went to he help page and figured
out how to get to the form builder. No way to insert an ActiveX
control but there is mention that user-defined objects are supported.
The deal killer was again the lack of support for automatic layouts.
If I write an app for just one platform then manual layout is okay.
But if I only support Macs then I'll use the Mac GUI builder. If I
only support X then ... all the toolkits I'll expect to use are
cross-platform so there's no need to support only X. If I only support
Windows then I'm at the conclusion I reached a few years ago.
Remember that simple chemistry app I tested? It did a bit of what
Merlin does, which is why I wanted a wxGrid with a sort indicator in
the column header. I looked around and realized VB makes it so easy
to slap together a simple Windows-only GUI app. With Access, it's
almost trivial to replace a lot of what Isis does, including the
ability to design your own query and report forms.
If I'm going to do Windows-only GUI app development then it's got to
be in an environment that at least comes close to what the Microsoft
toolset -- VB, VC++, GUI libraries, etc. -- provide. The ones I see
for wxPython even now just aren't there yet. So the best solution for
me is to write COM server code using Python and use VB to tie it all
together.
I'll also add that there just isn't a good plug-in 2D depiction system
for anything other than MS Windows. Major bummer! Oh, and the
wxPython startup time still seems rather lengthy, but it may just have
been PythonCard overhead.
I do like Qt as a library, and Qt Designer supports many of the things
I want, including ActiveX, GUI-assisted layout, tab-order, and Python
bindings. PyQt has its own set of problems, like the core dumps which
arise from deleting objects in the wrong order. (There was one talk
using Qt. The demos kept getting a core dump on exit because the code
didn't ensure qtApp was deleted last.) BlackAdder looks promising,
and it's cheaper to go that route than get a full Qt license.
Should I recommend desktop or web-based? I still have my preference
for a GUI app. I'll have to talk with them some more about the pros
and cons of the two.