Python Gtk.MessageDialog Hides Parent Window
Question: I am working on a Gtk3 app written in Python. The main window for my app is
set up as follows:

    
    
    #!/bin/python
    import gi
    gi.require_version('Gtk', '3.0')
    
    from gi.repository import Gtk as Gtk
    
    ## OTHER IMPORTS
    
    class MainGui(Gtk.Window):
        def __init__(self):
            Gtk.Window.__init__(self, title="APP TITLE")
    
            # Defaults
            self.set_default_size(600, 500)
    
            ## OTHER CODE            
    
            # Setup the Window
            self.connect("destroy", self.on_close)
            self.show_all()
    
        ## OTHER CODE    
    
        def on_close(self, widget):
            if self.editor.get_document().get_has_changes():
                save_dialog = Gtk.MessageDialog(self, 0,
                    Gtk.MessageType.QUESTION,
                    Gtk.ButtonsType.YES_NO,
                    "Save changes?")
                response = save_dialog.run()
    
                ## REST OF DIALOG HANDELING
    

The problem I'm having is related to the save dialog. The app displays the
dialog just fine, but it hides my main window, which is not the desired
effect. I've tried searching around for a solution, but can't seem to figure
out what I'm doing wrong. Any help would be greatly appreciated!


Answer: Shortly after posting this I realized that the reason things weren't working
is because of a bone-headed mistake. I was hooking up my on_close method using
this:

    
    
    self.connect("destroy", self.on_close)
    

It turns out I should be doing it this way:

    
    
    self.connect("delete-event", self.on_close)
    

Now things work great.

