Ejemplo n.º 1
0
def handle_operation(entry, label, state):
    inexpr = entry.props.text
    try:
        res = eval(inexpr, state)
        label.props.label = str(res)
    except Exception, err:
        util.show_error_dialog("Error", "Orden incorrecta:\n" + str(err))
Ejemplo n.º 2
0
def handle_operation (entry, label, state):
    inexpr = entry.props.text
    try:
        res = eval (inexpr, state)
        label.props.label = str (res)
    except Exception, err:
        util.show_error_dialog (
            "Error", "Orden incorrecta:\n" +
            str (err))
Ejemplo n.º 3
0
def handle_operation(entry, label):
    ops = entry.props.text.split()
    try:
        operador = ops[0]
        operandos = ops[1:]
        funcion = opfns[operador]
        res = funcion(*map(float, operandos))
        label.props.label = " = " + str(res)
    except (KeyError, IndexError, ValueError, TypeError):
        util.show_error_dialog("Error", "Orden incorrecta")