示例#1
0
def pedirEdad():
    edad = screen.Input("¿Qué edad tienes? ", 1, 1)
    while validaEdad(edad) == False:
        screen.Format(0, 33, 41)
        screen.Print("Edad inválida", 25, 1, True)
        screen.Reset()
        edad = screen.Input("¿Qué edad tienes? ", 1, 1)

    screen.clearLine(25)

    return int(edad)
示例#2
0
def pedirEdad():

    edad = screen.Input("Que edad tienes? ", 1, 1)

    while validaEdad(edad) == False:

        screen.Format(0, 30, 43)
        screen.Print("Error. edad invalida.", 25, 1, True)
        screen.Reset()
        edad = screen.Input("Reintroduce la edad: ", 1, 1)
    screen.clearLine(25)
    return int(edad)
示例#3
0
def pedirEdad():
    edad = screen.Input("¿Qué edad tienes? ", line=1, column=1)
    while validaEdad(edad) == False:
        screen.Print("Edad inválida",
                     line=25,
                     column=1,
                     style='bold',
                     color='yellow',
                     back='red')
        edad = screen.Input("¿Qué edad tienes? ", line=1, column=1)

    screen.clearLine(25)

    return int(edad)
示例#4
0
def printScreen():
    screen.Print("Sol..:",2,1)    
    screen.Print("OP1:",2,28)    
    screen.Print("OP2:",3,28)
    screen.Print("f:",4,30)
    input=screen.Input("INPUT ", 5, 1)
    valor=input.replace(',','.')
    return valor
示例#5
0
def main(input,file):
    
    banderaop1=False
    banderaop2=False
    banderaf=False
    
    while input!="fin": 
        #mientras tenga las casillas vacías, las voy llenando. Las casillas se llenan en cualquier orden
        if not banderaop1 or not banderaop2 or not banderaf:
            if validarinput(input) and not banderaop1:
                inputop1=float(input)
                screen.Print('{:.2f}'.format(inputop1),2,33)
                banderaop1=True
                
            elif validarinput(input) and not banderaop2 and banderaop1:
                inputop2=float(input)
                screen.Print('{:.2f}'.format(inputop2),3,33)
                banderaop2=True
                
            elif validarinput(input) and banderaop2 and banderaop1:
                screen.Print('Introduzca un operador',10,1)
                
            elif not validarinput(input) and input in operaciones:                 
                if not banderaf: 
                    screen.Print(input,4,33)
                    inputoperacion=input
                    screen.clearLine(10,1)
                    banderaf=True
                        
    
        #cuando tengo las tres casillas llenas, hago la operación     
                    
        if banderaop1 and banderaop2 and banderaf:
            banderaop1=False
            banderaop2=False
            banderaf=False
            if inputoperacion=='+':
                operacion=inputop1+inputop2
            elif inputoperacion=='-':
                operacion=inputop1-inputop2
            elif inputoperacion=='x':
                operacion=inputop1*inputop2
            elif inputoperacion=='d':    #no puedo hacer /
                operacion=inputop1/inputop2
            elif inputoperacion=='%':
                operacion=inputop1%inputop2
            elif inputoperacion=='//':
                operacion=inputop1//inputop2
            elif inputoperacion=='^':
                operacion=inputop1**inputop2
            
            screen.Print(operacion,2,8)
            
            #Escribo las operaciones en el fichero calculos.txt y borro datos sin el input
            #Si no se termina una operación completa, no se imprime nada en el fichero
            file.write("Sol..:{:3.2f}".format(operacion))
            file.write("          op1..:{:3.2f}\n\n".format(inputop1))
            file.write("                    op2..:{:3.2f}\n\n".format(inputop2))
            file.write("Input:")
            file.write("              f..:{:3s}".format(inputoperacion))         
            file.write("\n\n-------------------------------------------\n\n")
            
            printScreen2()
    
        
        input=screen.Input("INPUT ", 5, 1)
        input=input.replace(',','.')