Jul-02-2018, 05:33 AM
this my code, how do you think I would?
class MainFrame(wx.Frame): """""" #---------------------------------------------------------------------- def __init__(self): """Constructor""" wx.Frame.__init__(self, None, title="Test") panel = wx.Panel(self) btn = wx.Button(panel, label="Ask Question") btn.Bind(wx.EVT_BUTTON, self.showMessageDlg) #---------------------------------------------------------------------- def showMessageDlg(self, event): dial() #execute of other py file if __name__ == "__main__": app = wx.App(False) frame = MainFrame() frame.Show() app.MainLoop()dial.py
""" Show a message """ msg = "Do you want to continue?" title = "Question!" style = wx.YES_NO|wx.YES_DEFAULT|wx.ICON_QUESTION dlg = wx.MessageDialog(parent=None, message=msg, caption=title, style=style) result = dlg.ShowModal() if result == wx.ID_YES: print "User pressed yes!" else: print "User pressed no!" dlg.Destroy()