【文件属性】:
文件名称:wxPython in Action (2006).pdf
文件大小:12.57MB
文件格式:PDF
更新时间:2022-09-08 05:44:12
wxPython Application Development Cookbook Action
The wxPython part of the story actually begins in 1995, with Harri Pasanen
and Robin Dunn. Robin, who is one of the co-authors of the book, wrote the
following about the history of wxPython, and we decided that it was a story
better told in his own voice than paraphrased:
In 1995 I was working on a project that needed a GUI to be deployed on
HP-UX systems, but my boss also wanted to show something at a trade show
on his Windows 3.1 laptop in a few weeks’ time. So I started searching for a
cross platform C++ GUI toolkit to do a prototype with. In those days it
wasn’t easy without Google, but I found that there were several commercial
alternatives available (none of which is still available today) and lots of tool-
kits with freely available source.
While evaluating each of the free toolkits for my immediate needs and
deciding which of the commercial offerings would be best for our long-term
needs, I ran into the term “Python bindings” on the wxWidgets website (in
this case “binding” refers to the connection between the Python language
and the wxWidgets toolkit). Full of curiosity at how one would “bind” a soft-
ware toolkit to a reptile (I had never heard of the Python language up to this
point), I clicked on the link, and the next link, and the next, until I finally
ended up at the Python 1.2 Tutorial document. Three hours later I was con-
verted from being the local C++ guru to a Python evangelist bugging all
xx
PREFACE
the developers in the immediate vicinity and showing them the cool new thing
I had discovered.
Instead of working on my prototype, I started working with Harri Pasanen in
Finland to advance the Python bindings for wxWidgets, otherwise known as
wxPython 0.2, with some help from Edward Zimmerman. The mailing list
announcement of that release is archived here: (http://www.google.com/
groups?selm=PA.95Jul27032244@ok.tekla.fi&oe=UTF-8). We got it to be
functional enough that I could build the prototype for my boss using Python,
but wxPython was a nightmare to maintain and to enhance because everything
(C++ extension module code, Python proxy modules, build system, etc.) was
done by hand, and little changes or enhancements to wxWidgets would often
require changes to several places in wxPython code to add the support for the
enhancement or fix to wxPython. When it reached many tens of thousands of
lines of code it became very awkward and fragile to continue working in that
manner. Add to that the fact that there was no central source code repository
(this was also before SourceForge’s time) so we were emailing code changes to
each other—you can get an inkling of the difficulties involved.
About that time, I had to start doing “real” work again as my main project was
building up from a gleam in the eye to a full-force development project with
several developers under my control with design meetings and deadlines, and
I found myself fully back in the C++ world again, although I was able to use
Python for some of the build and test scripts for the project. Harri wasn’t able
to spend any time on it either, so wxPython development slowed to less than a
crawl and eventually stopped.
In 1997 I discovered SWIG (Simple Wrapper and Interface Generator), and
realized that it could help with all the maintenance issues that had pained us
in the wxPython project. In three or four weeks of spare time using SWIG,
I almost completely reimplemented everything in wxPython that had taken
several weeks of full-time work on my part and several months of part-time
work for Harri doing it by hand. After getting sidetracked on another
project for a while, I discovered that wxWidgets 2.0 was in active develop-
ment, but had a whole new architecture, so I had to do it all again. But this
time the new architecture simplified things enough that it took only about a
week’s worth of spare time! So in the summer of 1998 the first “modern ver-
sion” of wxPython was released and has been in active development ever
PREFACE
xxi
since. The first announcement is archived here: (http://groups.yahoo.com/
group/python-announce-list/message/95).
The rest is, as they say, history. It’s important to note that SWIG is allowing me
to easily create and maintain literally hundreds of thousands of lines of code, so
much of the credit for the vastness of wxPython’s feature set deserves to go to
David Beazley and the other developers contributing to that project.
With this book, we hope to share with you our excitement about wxPython, a
toolkit that is truly unique in the ease that it brings to GUI application develop-
ment. We wrote it with the goal of creating a useful resource for both the novice
and the pro.