Here's how I would do it:

    def Validate(self, parent):
        try:
            text_ctrl = self.GetWindow()
            text = text_ctrl.GetValue()
            if not text: raise ValueError
            if int(text) <= 0: raise ValueError
            return True
        except ValueError, error:
            wx.MessageBox('Enter a valid time.', 'Invalid time
entered', wx.OK | wx.ICON_ERROR)
            return False

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to