When top-level windows are destroyed they are not killed immediately but are instead added to a list of windows to be destroyed later. What "later" actually means in this case is a little nebulous. I don't remember for sure, but I think it happens after EVT_IDLE events are sent and processed, or as part of the wx.App's EVT_IDLE handler, or something like that. Also, IIRC, the idle events are not sent during a wx.Yield, because the application is not idle at that point in time. (There are the pending events that need processed, if any, and then there is the code after the call to Yield that is waiting to run.
If you allow control to return to the event loop and then check the state of the dialog a little later, then most likely it has been destroyed by then. It's not guaranteed however, because if the app is really busy then there may not have been a chance to process the idle events.
def OnButton(self, event):
dialog = wx.Dialog(self, -1, "ssss")
wx.CallLater(100, self._later, dialog)
def _later(self, dialog):
print(self.GetChildren())
print( "wx version", wx.version())
print("is child", dialog in self.GetChildren())
print("is being deleted", dialog.IsBeingDeleted())
print("not yet destroyed", bool(dialog))
--
Robin