from easygui import * class Demo2(): def __init__(self): msg = "Without flicker. Enter your personal information" title = "Credit Card Application" fieldNames = ["Name", "Street Address", "City", "State", "ZipCode"] fieldValues = [] # we start with blanks for the values fieldValues = multenterbox(msg, title, fieldNames, fieldValues, callback=self.check_for_blank_fields) print("Reply was: {}".format(fieldValues)) def check_for_blank_fields(self, box): # make sure that none of the fields was left blank cancelled = box.values is None errors = [] if cancelled: pass else: # check for errors for name, value in zip(box.fields, box.values): if value.strip() == "": errors.append('"{}" is a required field.'.format(name)) all_ok = not errors if cancelled or all_ok: box.stop() # no problems found box.msg = "\n".join(errors) Demo2()
settings
unfold_less visibility play_arrow