Hi, When I run this code and focus on choice it is raise a error. I close this message but it is come back again. I want to see only one time this message. How can i do this? What is error in my code ?
Note: I'm sorry for my English. I know it isn't good.
#! -*- coding:utf-8 -*-
import wx
class MyPanel(wx.Panel):
   def __init__(self, parent, *args, **kwargs):
       wx.Panel.__init__(self, parent, *args, **kwargs)
       sizer = wx.BoxSizer(wx.HORIZONTAL)
       self.my_choice = wx.Choice(self, wx.NewId())
       self.my_button = wx.Button(self, wx.NewId(), label = "Procces")
       self.my_button.SetFocus()
       sizer.AddMany([(self.my_choice, 0, wx.ALL, 5),
                      (self.my_button, 0, wx.ALL, 5)])
       self.SetSizer(sizer)
       self.my_choice.Bind(wx.EVT_SET_FOCUS, self.my_choice_on_focus)
       self.my_button.Bind(wx.EVT_BUTTON, self.my_button_on_clicked)
   def my_choice_on_focus(self, evt):
       try:
           self.my_choice.Clear()
           print "Input some items in my_choice"
           raise RuntimeError
       except RuntimeError:
           dlg = wx.MessageDialog(self, "test EVT_SET_FOCUS", "Error", wx.ICON_ERROR|wx.OK )
           dlg.ShowModal()
           dlg.Destroy()
           raise
       evt.Skip()
   def my_button_on_clicked(self, evt):
       print "Procces my choice value"
       evt.Skip()
class MyApp(wx.App):
   def OnInit(self):
       frame = wx.Frame(None, title = "Test")
       panel = MyPanel(frame)
       frame.Show()
       self.SetTopWindow(frame)
       return True
if __name__ == '__main__':
   app = MyApp(redirect = False)
   app.MainLoop()