1. What is it?
  2. Source Code
  3. Installing
    1. Mac OSX
    2. Fedora Linux
  4. Screenshots

What is it?

PyMPG is a simple tool for keeping track of your gas mileage, meaning fuel economy, how much you're driving, etc. It is written in Python using PyGTK, so it was a learning exercise in both Python and GTK. It replaces a web-based tool I called PGMDB (PHP Gas Mileage Database).

So far, here's what it can do:

See HISTORY for more info.

Source Code

PyMPG is not well tested, but it does what I need it to do. Please send me your feedback! There's no real need to compile a binary with Python, so what you want is the source code. PyMPG is now the trunk of the pgmdb tree.

The best way to get it is with Subversion (SVN):

svn co https://pgmdb.svn.sf.net/svnroot/pgmdb/trunk PyMPG



I used MacPorts in order to get Python with PyGTK, although there are probably other ways to install PyGTK to the default Mac OSX Python installation. These instructions were useful.

Install Python 2.5 and PyGTK:

sudo port -v install python25  py25-gtk

Make sure you're calling the right Python, might want to use python_select in order to make this permanent.

which python2.5

Since I want to use the Python from MacPorts, I invoke the script using:

python2.5 PyMPG.py

Fedora Linux

A great deal of GUI's for Linux already use the Python/PyGTK combination, so you probably are set up already. To be sure, you can check for the packages python and pygtk2.

To get it going, make it executable and call it from your shell, or call it as an argument to Python, using python PyMPG.py. It will accept a file name to open as an argument for convenience. The usage summary follows:

PyMPG [filename.csv]

Eventually, more arguments will be accepted for automating tasks.


Everybody loves screenshots: