Hi,
today I noticed something funny.
My app creates modal dialogs.
A snippet of the class __init__ for a modal (custom) dialog would be
class Dialog(wx.Dialog):
def __init__(self):
# stuff omitted here
self.CentreOnParent()
self.ShowModal()
def close(self,event):
self.EndModal()
self.Destroy()
The caller would do
dlg=DialogClass(params)
if dlg.GetReturnCode():
something here
this will block until the dialogclass goes into the close method.
Funny thing though: On GTK (not GTK2, didn't test that) the above code works,
specially the self.Destroy() in the close method. The dlg is still around on
GTK, even after the explicit destroy.
On win32 however it obviously isn't always (sometimes it is, sometimes not and
I get an assert exception - PyDeadObject....)
So here the question: I don't want to do the ShowModal() and Destroy in the
caller, I'd rather have the dialog take care of itself. If I wouldn't do the
self.Destroy() and I deleted the reference kept in "dlg" in the caller, will
the dialog be destroyed automatically (no more references to it) ? Or do I
have to do an explicit Destroy() to get rid of it ?
Thx
UC
···
--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417