def validate(self):
"""
Validates the input. Returns ``True`` unless the field is blank and
*optional* is ``False``.
"""
if not self.enabled:
return True
elif not self.optional and len(self.value.get()) == 0:
tkMessageBox.showwarning("", "{} not specified.".format(self.text))
return False
else:
return True
评论列表
文章目录