Código Python:
Ver original#!/usr/bin/python
import gtk
class PyApp(gtk.Window):
def __init__(self):
super(PyApp, self).__init__()
self.set_size_request(250, 100)
self.set_position(gtk.WIN_POS_CENTER)
self.set_title("Quit example")
self.connect("delete_event", self.on_delete)
self.connect("destroy", gtk.main_quit)
quit_button = gtk.Button("Quit")
quit_button.connect("clicked", self.on_quit)
self.add(quit_button)
self.show_all()
def __quit(self):
md = gtk.MessageDialog(self,
gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION,
gtk.BUTTONS_YES_NO, "Are you sure to quit?")
response = md.run()
md.destroy()
return response == gtk.RESPONSE_YES
def on_delete(self, widget, data=None):
return not self.__quit()
def on_quit(self, widget):
if self.__quit():
self.destroy()
PyApp()
gtk.main()
Un ejemplo de lo quieres hacer.