예제 #1
0
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")
예제 #2
0
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")
예제 #3
0
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)
예제 #4
0
def minput(text=""):
    mprint("<default>%s<bold>" % text)
    result = input()
    mprint("<default>")
    return result
예제 #5
0
def mpause(text="Press enter to continue..."):
    mprint(text)
    input()