How do I safely destroy a dialog window of a wxPython application?
- by Akira
I created a wxPython application which shows some messages on a dialog window. The dialog window is needed to be force-destroyed by the application before I click the dialog OK button. I used wx.lib.delayedresult to make the destroy call.
My code is:
import wx
dlg=wx.MessageDialog(somewindow,'somemessage')
from wx.lib.delayedresult import startWorker
def _c(d):
dlg.EndModal(0)
dlg.Destroy()
def _w():
import time
time.sleep(1.0)
startWorker(_c,_w)
dlg.ShowModal()
This can do what I desire to do while I got a error message below:
(python:15150): Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed
How do I "safely" destroy a dialog without clicking the dialog button?