If you are using the Gtk.ApplicationWindow you can listen to the event using:
# connect Listener
win.connect("close-request", onWindowCloseEvent)
# eventListener
def onWindowCloseEvent (self, window):
print(window)
print("Window destroyed")Previously there was "destroyed" and "close-event" (or something like this). Those two are obsolete now according to their Gitlab Bugtracker.
To just ignore the event use return True in the EventListener
# eventListener
def onWindowCloseEvent (self, window):
return TrueThe event shouldn't be executed further
There's a second way, that puts the Window in background and keeps it running. Using the set_hide_on_close Event
self.set_hide_on_close( True )