dialog.connect("delete-event", \
lambda w, e: dialog.hide() or True)
This is helpful when you have logic that replaces individual widgets inside a dialog and you don’t want to recreate the whole dialog. The user is still allowed to close the dialog without destroying the child widgets and you don’t need to go through the hassle of unparenting children or any complicated logic.
Now I can keep referring solely to the child objects and get ahold of their parent dialog details through calls to widget.get_parent.