I created a wxPython application that shows some messages in a dialog box. The dialog box is necessary for forced destruction by the application before clicking the OK dialog button. I used wx.lib.delayedresult to call 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 want to do while I received the error message below:
(python: 15150): Gtk-CRITICAL **: gtk_widget_destroy: statement `GTK_IS_WIDGET (widget) 'failed
How to "safely" destroy a dialog box without clicking a dialog button?
Akira source
share