#!/usr/bin/python

import pyatspi

def onKeyPressOrRelease(event):
    print "onKeyPressOrRelease: %s" % event

pyatspi.Registry.registerKeystrokeListener(
    onKeyPressOrRelease,
    kind=(pyatspi.KEY_PRESSED_EVENT, pyatspi.KEY_RELEASED_EVENT))
pyatspi.Registry.start()

pyatspi.Registry.deregisterKeystrokeListener(
    onKeyPressOrRelease,
    kind=(pyatspi.KEY_PRESSED_EVENT, pyatspi.KEY_RELEASED_EVENT))
pyatspi.Registry.stop()
