For the past few months, it had been a Pythonic experience for me. My former boss talked to me one day and asked me if I could develop a program for a water billing firm. Without hesitation, I said yes and not even thinking of how I'll do it. That time, I was biting my nails and learning deeper about Python. My first problem was the GUI...Tkinter.

I couldn't understand Tkinter due to the lack of resources and tutorial stuff. Then, I fired up my browser, go to handy dandy Google website and typed in 'python gui'. The first few results point to the Python Wiki, which had a bunch (lots of them). The next few Google results pointed to wxPython. I have heard of wx-*something* before... ah it was when I was tinkering with C++... wxWidgets. Yes, I have tried backtracking myself to C++ too. (Which I feel should be the language after Python then Java).

Going back to the water meter billing system, I asked my former boss if it would be desktop or web? He replied if I could work it out for both. I said again yes. What in the arse was I thinking?! So I sticked with the idea of Python + wxPython and deal with the web approach later (Django or TurboGears). I fired up Firefox and pressed CTRL + K, typed in 'wxpython tutorials'. Then at some point the results have taken me to Jan Bodnar's site: ZetCode Tutorials. I talked to Jan Bodnar on a few emails. The guy was kind enough to talk to me (lucky me). By the time I realized it, I was proposing him to add tutorials for SQLAlchemy - datastore mapper toolkit for Python. He said some time in the future.

As you can guess by now, my backend (database) is now composed of SQLAlchemy + (database). The database is SQLite v3+. As of Python 2.5.2, SQLite3 is included in the libraries. I could never ask for more: zero configuration, serverless, and simple. Later I added Elixir - high level ORM on top of SQLAlchemy.

wxPython is easy. Download the docs + binaries HERE. But before I dived into the docs provided by wxPython, I read first the tutorials from Jan Bodnar. His tutorial on wxPython rocks!

wxPython should be installed from binaries for all platforms (unless developing for wxPython). I use setuptools for SQLAlchemy and Elixir as well as other libs and addons.

Fast forwarding... I have built my app pictured below.

Now here comes the real problem. Binary distributing your Python application! Googling again: py2exe. Some time later, I found out that py2exe have issues with setuptools and its eggs (jars are to Java). The first few nights, I couldn't build a sane distribution. Py2exe complains it cannot find some packages. Again, searching the web for answers: the only solution is installing a Python egg UNZIPPED! I have unpacked all my egg dependencies, but still py2exe complains of not finding 'pkg_resources' package.. Well, I did unzipped all the eggs but one egg was not unzip, the setuptoolsxxx.egg. --Unzipping that and run my setup.py again and voila!

I added some optimizing and buffering options, and I am very much pleased with my first Python app.

This entry was written for Tech Source from Bohol by Jose Marie Maranan, a Filipino software developer and a Pythonista (founding member of the Philippine Python User Group).