python - MessageDialog doesn't close -
i have python application wx.dirpicker command can manually changed , need sure chosen path exists before running code. i'm using this:
def m_dirpicker1onupdateui( self, event ): src_directory = self.m_dirpicker1.gettextctrlvalue() if os.path.exists(src_directory)==false: dlg = wx.messagedialog( self, "the specified path doesn't exist", "warning", wx.icon_error | wx.icon_exclamation ) dlg.showmodal() #print(dlg.getreturncode()) if dlg.getreturncode() == 0: self.destroy()
it works fine, detecting if path exists.
however, when path doesn't exist message dialog appears can't close after pressing ok button, , don't understand why.
thank you.
i think should phone call "dlg.destroy()" before "self.destroy()":
result = dlg.showmodal() dlg.destroy() if result == 0: self.destroy()
python messagedialog
No comments:
Post a Comment