PyGTK lets you to easily create programs with a graphical user interface using the Python programming language. The underlying GTK+ library provides all kind of visual elements and utilities for it and, if needed, you can develop full featured applications for the GNOME Desktop.
PyGTK applications are truly multiplatform and they're able to run, unmodified, on Linux, Windows, MacOS X and other platforms.
Other distinctive features of PyGTK are, besides its ease of use and rapid prototyping, its first class accesibility support or the capability to deal with complex multilingual or bidirectional text for fully localized applications.
PyGTK is free software, so you can use, modify, distribute and study it with very few restrictions (LGPL license).
This code permits to perform some actions, if a keyboard mapping has changed (eg with setxkbmap)
print "kbd mapping changed"
keymap = gtk.gdk.keymap_get_default()