-
Benoit Favre authoredBenoit Favre authored
dialog.py 790 B
from gi.repository import Gtk
def alert(message):
dialog = Gtk.MessageDialog(None, Gtk.MessageType.INFO, message_format=message)
dialog.set_border_width(10)
#dialog.add_button("Cancel", Gtk.ResponseType.CANCEL)
dialog.add_button("OK", Gtk.ResponseType.OK)
dialog.run()
dialog.destroy()
def confirm(question):
dialog = Gtk.MessageDialog(None, Gtk.MessageType.INFO, message_format=question)
dialog.set_border_width(10)
dialog.add_button("Cancel", Gtk.ResponseType.CANCEL)
dialog.add_button("OK", Gtk.ResponseType.OK)
response = dialog.run()
dialog.destroy()
if response == -5:
return True
return False
if __name__ == '__main__':
alert('This is a simple alert')
if confirm('Do you want to quit?'):
print 'bye'