Skip to content

Latest commit

 

History

History
27 lines (23 loc) · 954 Bytes

WindowCloseEvent.md

File metadata and controls

27 lines (23 loc) · 954 Bytes

Window Close Event / Close-Request Event

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.

prevent Window Close Event

To just ignore the event use return True in the EventListener

# eventListener
def onWindowCloseEvent (self, window):
    return True

The 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 )