Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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)
Exemplo n.º 4
0
def minput(text=""):
    mprint("<default>%s<bold>" % text)
    result = input()
    mprint("<default>")
    return result
Exemplo n.º 5
0
def mpause(text="Press enter to continue..."):
    mprint(text)
    input()