from gi.repository import Gtk, GLib

w = Gtk.Window()
b = Gtk.Button(label="Click me to pop up a dialog in a few seconds.")
w.add(b)

def dialog_me():
    d = Gtk.Dialog(parent=w)
    d.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK)
    d.connect('response', lambda *args: d.destroy())
    d.run()
    return False

b.connect('clicked', lambda *args: GLib.timeout_add_seconds(7, dialog_me))
w.show_all()
w.move(0, 0)
w.connect('destroy', lambda *args: Gtk.main_quit())
Gtk.main()


