def ToRegister(self, event): username = self.Register.username.GetValue() password = self.Register.password.GetValue() conform = self.Register.conform.GetValue() print("password:{0},conform:{1}".format(password, conform)) if password != conform: wx.MessageBox("密码不一致!", "提示!", wx.OK, self) return lenu = len(username) lenp = len(password) if lenu <= 0: wx.MessageBox("用户名长度过短,请重新输入!", "提示!", wx.OK, self) return if lenu > 16: wx.MessageBox("用户名长度过长,请重新输入!", "提示!", wx.OK, self) return if lenp < 4: wx.MessageBox("密码长度过短,请重新输入!", "提示!", wx.OK, self) return if lenp > 20: wx.MessageBox("密码长度过长,请重新输入!", "提示!", wx.OK, self) return Chat.toRegister(username, password)