Está en la página 1de 8

import math

from tkinter import *

from tkinter import messagebox

import numpy as np

def nuevo():

fd.delete(0,END)

alt.delete(0,END)

def calcular():

alt.delete(0,END)

if pefi.get()=='' or pefd.get()=='' or pec.get()=='' or fd.get()=='':

messagebox.showerror('ERROR','FALTAN DATOS')

else:

PEFI=eval(pefi.get())

PEFD=eval(pefd.get())

PEC=eval(pec.get())

l=eval(fd.get())

ang=math.atan(80/l)

L=10/(math.sin(ang))

XX=(L*L-100)
E=0.00001

error=1

H=1

while E<error:

fh=(H**3/6)-H*((l**2/6)+1.8)-((-86*l**2/3)+500/3-(10*XX/3))

f_h=3*H**2/6-(l**2/6+1.8)

H_i=H-fh/f_h

error=abs(H-H_i)

H=H_i

RESULT=abs(H)

alt.insert(0,str(round(RESULT,5)))

pantalla=Tk()

pantalla.geometry('670x615+310+30')

pantalla.config(bg='#BB1519')

pantalla.title("FUERZA EN SUPERFICIES INCLINADAS")


pantalla.resizable(0,0)

#Imagen de fondo

#imagen1=PhotoImage(file='civil.png')

#imagen2=PhotoImage(file='esquema1.png')

#CREAMREMOS UN CANVAS

FONDO=Canvas(pantalla,height=56,width=52)

FONDO.create_image(0,0,anchor=NW)

FONDO.place(x=160,y=68)

FONDO1=Canvas(pantalla,height=310,width=325)

FONDO1.create_image(0,0,anchor=NW)

FONDO1.place(x=30,y=268)

#_____________________________________________

# ENTRY PARA CADA VARIABLE

#_____________________________________________

Label(pantalla,text="PESOS ESPECIFICOS",

fg="white",bg='#BB1519',

font=("arial 18 bold")).place(x=385,y=20)

Label(pantalla,text="Fluido Izquierdo w :",

bg='#BB1519',fg="white",

font=("arial 12 ")).place(x=385,y=65)
Label(pantalla,text="w (ton/m): 1 ",bg='#BB1519',

font=("arial 14 bold")).place(x=435,y=90)

pefi=Entry(pantalla,width=10,fg="white",bg="black",

font=("arial 14 bold"))

#pefi.place(x=530,y=90)

Label(pantalla,text="Fluido Derecho w :",

bg='#BB1519',fg="white",

font=("arial 12 ")).place(x=385,y=125)

Label(pantalla,text="w (ton/m): 1 ",bg='#BB1519',

font=("arial 14 bold")).place(x=435,y=150)

pefd=Entry(pantalla,width=10,fg="white",bg="black",

font=("arial 14 bold"))

#pefd.place(x=530,y=150)

Label(pantalla,text="Concreto c :",

bg='#BB1519',fg="white",

font=("arial 12 ")).place(x=385,y=185)

Label(pantalla,text="c (ton/m): 2.4 ",bg='#BB1519',

font=("arial 14 bold")).place(x=435,y=210)

pec=Entry(pantalla,width=10,fg="white",bg="black",

font=("arial 14 bold"))

#pec.place(x=530,y=210)

Label(pantalla,text="FUERZA PUNTUAL",

fg="white",bg='#BB1519',
font=("arial 18 bold")).place(x=405,y=260)

Label(pantalla,text="Fuerza de Hielo Fh :",

bg='#BB1519',fg="white",

font=("arial 12 ")).place(x=385,y=305)

Label(pantalla,text="Fh (ton): 1.8 ",bg='#BB1519',

font=("arial 14 bold")).place(x=453,y=330)

fp=Entry(pantalla,width=10,fg="white",bg="black",

font=("arial 14 bold"))

#fp.place(x=530,y=330)

Label(pantalla,text="FUERZA DISTRIBUIDA",

fg="white",bg='#BB1519',

font=("arial 18 bold")).place(x=385,y=380)

Label(pantalla,text="Empuje de Suelo :",

bg='#BB1519',fg="white",

font=("arial 12 ")).place(x=385,y=425)

Label(pantalla,text="Longitud l (m) ",bg='#BB1519',

font=("arial 12 bold")).place(x=410,y=450)

fd=Entry(pantalla,width=10,fg="white",bg="black",

font=("arial 14 bold"))

fd.place(x=530,y=450)
Label(pantalla,text="h (m): ",bg='#BB1519',

font=("arial 18 bold")).place(x=385,y=555)

alt=Entry(pantalla,width=14,fg="white",bg="black",

font=("arial 18 bold"))

alt.place(x=460,y=555)

Label(pantalla,text="UNIVERSIDAD NACIONAL DE HUANCAVELICA",

bg='#BB1519',fg="white",

font=("arial 9 bold")).place(x=65,y=5)

Label(pantalla,text="Escuela Profesional de Ingenieria",

bg='#BB1519',fg="white",

font=("arial 9 bold")).place(x=92,y=25)

Label(pantalla,text="Civil - Huancavelica",

bg='#BB1519',fg="white",

font=("arial 9 bold")).place(x=141,y=40)

Label(pantalla,text="Catedra : Mecanica de Fluidos I",

bg='#BB1519',fg="white",

font=("arial 9 bold")).place(x=40,y=133)
Label(pantalla,text="Catedratico : Ing. Anderson Condori Paytan",

bg='#BB1519',fg="white",

font=("arial 9 bold")).place(x=40,y=153)

Label(pantalla,text="Ciclo y Secc. : V-B ",

bg='#BB1519',fg="white",

font=("arial 9 bold")).place(x=40,y=173)

Label(pantalla,text="____________________________________________________________
_________________________",

bg='#BB1519',fg="white",

font=("arial 6 ")).place(x=20,y=190)

Label(pantalla,text="ESQUEMA",

bg='#BB1519',fg="white",

font=("arial 18 bold")).place(x=130,y=215)

Button(pantalla,text="CALCULAR",width=9,font=("arial 13 bold"),

command=calcular).place(x=410,y=505)

Button(pantalla,text="NUEVO",width=9,font=("arial 13 bold"),

command=nuevo).place(x=530,y=505)

#_____________________________________________

#ENTRY PARA CADA VARIABLE: VALORES POR DEFECTO

#_____________________________________________

pefi.insert(0,"1")
pefd.insert(0,"1")

pec.insert(0,"2.4")

fp.insert(0,"1.8")

#__init__.py

pantalla.mainloop()

También podría gustarte