from gi.repository import Gtk, Gdk

w = Gtk.Window()
b = Gtk.Button("test")
w.add(b)
w.show_all()
w.connect('destroy', Gtk.main_quit)
def cb(button, event):
    print event
    state = event.get_state()
    print (state)
    return True

b.connect('button-press-event', cb)

Gtk.main()
