def debugHandler(widget, event, *a):
 if (event.type in event_types):
  print event.type.value_nick

def debugHandler ( widget , event , * a ) : if ( event . type in event_types ) : print event . type . value_nick
just connect it to the event event .