I am very new to wxpython. I have a dialogue box where if the user clicks ok then it should trigger an event. I am not sure as to how an event is bound to the button in the dialogue box. I tried using normal method calling but this was leading to a problem, When I close the application the program is not getting terminated at the terminal level.
I have tried using some thing like this.
def OnclickMe(self, event):
dlg = wx.MessageDialog(None, 'Is this right', 'MessageDialog', wx.YES_NO | wx.ICON_QUESTION)
result = dlg.ShowModal()
if result == wx.ID_YES:
self.IfYes()
dlg.Destroy()
def IfYes(self):
dlg = wx.TextEntryDialog(None, "Wats ur opinion?", 'A Question', '')
if dlg.ShowModal() == wx.ID_OK:
response = dlg.GetValue()
Please help.
When you call IfYes(), you pause the destruction of the first dialog until the second dialog is closed / destroyed. I think it will work if you destroy the TextEntryDialog though. Execution should return to the “if” statement and fall out of that, thus destroying the dialog. If you still have issues, try taking the IfYes() method call out of the conditional. Something like this should work:
Yeah, it’s a hack, but I’m just curious if that works…