from gi.repository import GLib, Notify

def action_callback(notification, action_id, data):
    print action_id

def quit_callback(notification):
    loop.quit()

if __name__ == '__main__':

    Notify.init('Interactive Notifications')

    notification = Notify.Notification.new("Foo", "Bar")

    notification.set_hint_string("x-canonical-switch-to-application", "true")
    notification.add_action(
        "action_id",
        "action_label",
        action_callback,
        None,
        None
    )

    loop = GLib.MainLoop.new(None, False)
    notification.connect('closed', quit_callback)
    notification.show()
    loop.run()
