GNU Solfege is *free* eartraining software written in python. The program is designed to be easily extended with lesson files (data files), so the user can create new exercises. You can build it as a GNOME application, or just use the gtk+ libraries.