Hello,
I’m having trouble checking the destroyed state of wx.Dialogs. When I call ‘.Destroy()’ and do a ‘wx.Yield()’ the dialog is not reported as destroyed:
dialog = wx.Dialog(self, -1, “”)
result = dialog.ShowModal()
dialog.Destroy()
wx.Yield()
print “wx version”, wx.version()
print “is child”, dialog in self.GetChildren()
print “is being deleted”, dialog.IsBeingDeleted()
print “not yet destroyed”, bool(dialog)
``
Output:
wx version 3.0.2.0 msw (classic)
is child True
is being deleted False
not yet destroyed True
``
As far as I know this is the way it should be done according to a couple posts of people with similar questions.
I’ve tried many other things like multiple yields, time.sleep(), self.Refresh(), self.Update(). I’ve found one thing: if i create a new dialog and call ‘.ShowModal()’, the first (destroyed) dialog is correctly reported as destroyed
I’ve attached my whole test script as an attachment. I’ve tested this in version 3.0.2.0 msw (the one we currently use) and in the latest version i get from ‘pip install wxPython’: 4.0.6 msw (phoenix) wxWidgets 3.0.5.
Any help would be greatly appreciated
Thanks,
Jasper
Alexion Software
dialogdestroytest.py (638 Bytes)
output.txt (202 Bytes)