What is the purpose of dlg.Destroy() ? Isn’t dlg destroyed when someone clicks on the “OK” button, or the close icon in the top right of the dialog box? I wasn’t able to observe a difference omitting the line dlg.Destroy()
What is the purpose of dlg.Destroy() ? Isn't dlg destroyed when someone clicks on the "OK" button, or the close icon in the top right of the dialog box? I wasn't able to observe a difference omitting the line dlg.Destroy()
A dialog should stay around after the user closes it that you can get at its data, but 'Destroy' needs to be called on it at some point otherwise it will prevent the application from closing.
As of 2.8.11.0 you can do the above like this:
with wx.MessageDialog(self, 'message', "caption", wx.OK) as dlg:
if dlg.ShowModal() == wx.ID_OK:
# do something with dlg values