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:
- Create a new file
- Load/save CSV data files
- Create new fueling record
- Edit records
- Display expanded data in a table
- Show a summary
- Communicate with GNUPLOT to plot miles/day, miles/gallon, and dollars/gallon.
See HISTORY for more info.
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.
Since I want to use the Python from MacPorts, I invoke the script using:
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:
Eventually, more arguments will be accepted for automating tasks.
Everybody loves screenshots: