def memail_input(text=""): mprint("<default>%s<bold>" % text) result = input() mprint("<default>") if "@" in result and "." in result: return result else: raise ValueError("Input is not email")
def mnum_input(text=""): mprint("<default>%s<bold>" % text) result = input() mprint("<default>") if mis_number(result): return float(result) else: raise ValueError("Input is not numeric")
def mquestion(text, yes=True): yesno = "y/N" if yes: yesno = "Y/n" mprint("%s <bold>[%s]</bold> " % (text, yesno)) result = input() if (result == "" and yes) or result.lower().startswith("y"): return True elif (result == "" and yes is False) or result.lower().startswith("n"): return False else: raise ValueError("Invalid value returned from input: %s" % result)
def minput(text=""): mprint("<default>%s<bold>" % text) result = input() mprint("<default>") return result
def mpause(text="Press enter to continue..."): mprint(text) input()