How do I safely destroy a dialog window of a wxPython application?
Posted
by
Akira
on Stack Overflow
See other posts from Stack Overflow
or by Akira
Published on 2011-09-08T20:46:18Z
Indexed on
2011/11/30
17:50 UTC
Read the original article
Hit count: 234
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?
© Stack Overflow or respective owner