0% found this document useful (0 votes)
18 views4 pages

Dayana 1

The document describes a Python program that builds a graphical user interface for calculating transmission reliability and availability. It imports various Kivy modules, defines classes for the app and layout, and adds widgets like images, labels, text inputs and buttons to the layout.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Dayana 1

The document describes a Python program that builds a graphical user interface for calculating transmission reliability and availability. It imports various Kivy modules, defines classes for the app and layout, and adds widgets like images, labels, text inputs and buttons to the layout.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

import kivy

import math
kivy.require('1.9.0')
from kivy.app import App
from kivy.lang import Builder
from kivy.config import Config
Builder.load_file('hola5.kv.py')
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
from kivy.core.window import Window
from kivy.uix.video import Video
from kivy.properties import NumericProperty
Config.set('graphics','width',400)
Config.set('graphics','heigth',200)

class FondApp(App):
def funcion(self,instance):
try:
a=float(self.texto_in.text)
b=float(self.texto_in1.text)
c=a+b
print("La suma es: ",math.log10(c))
except:
print("Ocurrio un error")
def Pot_Recepci�n(self,instance):
d=92.45+20*math.log10(float(self.texto_in.text))
+20*math.log10(float(self.texto_in4.text))
e=float(self.texto_in1.text)+float(self.texto_in2.text)
+float(self.texto_in3.text)
f=float(self.texto_in4.text)+float(self.texto_in5.text)+d
g=e-f
print(g)
def Cambiar_imagen(self,instance):
self.fond.remove_widget(self.image1)
self.fond.remove_widget(self.boton)
self.fond.add_widget(self.image2)
def build(self):
self.fond=FloatLayout()

self.image1=Image(source='C:/Python37/Scripts/ondas.PNG',allow_stretch=True,keep_ra
tio=False)

self.image2=Image(source='C:/Python37/Scripts/ondas2.PNG',allow_stretch=True,keep_r
atio=False)

self.titulo=Label(text="C�LCULO DE LA FIDELIDAD E
INDISPONIBILIDAD",size_hint=(0.2,0.1),pos_hint= {'x':0.5,'y':0.92})
self.boton=Button( text="Calcular",size_hint=(0.08,0.08),pos_hint=
{'x':0.1,'y':0.05})
self.texto=Label(text="frecuencia (Ghz)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.90})
self.texto_in=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.90},input_filter='float')
self.texto1=Label(text="Potencia TX (dBm)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.85})
self.texto_in1=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.85},input_filter='float')
self.texto2=Label(text="Ganancia Tx (dbi)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.80})
self.texto_in2=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.80},input_filter='float')
self.texto3=Label(text="Ganancia Rx (dbi)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.75})
self.texto_in3=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.75},input_filter='float')
self.texto4=Label(text="Perdidas por conectores
(dB)",size_hint=(0.05,0.05),pos_hint= {'x':0.1,'y':0.70})
self.texto_in4=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.70},input_filter='float')
self.texto5=Label(text="Perdida por
filtros,circuladores(dB)",size_hint=(0.05,0.05),pos_hint= {'x':0.1,'y':0.65})
self.texto_in5=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.65},input_filter='float')
self.texto6=Label(text="Distancia (km)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.60})
self.texto_in6=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.60},input_filter='float')
#######################
self.etiqueta1=Label(text="TRANSMISI�N" ,size_hint=(0.15,0.15),pos_hint=
{'x':0.1,'y':0.50})
self.texto7=Label(text="Altura (m.s.n.m)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.45})
self.texto_in7=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.3,'y':0.45},input_filter='float')
self.texto8=Label(text="Latitud (�,',?)",size_hint=(0.05,0.05),pos_hint=
{'x':0.1,'y':0.40})
self.texto_in81=TextInput(text="",size_hint=(0.03,0.05),pos_hint=
{'x':0.2,'y':0.40},input_filter='float')
self.texto_in82=TextInput(text="",size_hint=(0.03,0.05),pos_hint=
{'x':0.25,'y':0.401},input_filter='float')
self.texto_in83=TextInput(text="",size_hint=(0.03,0.05),pos_hint=
{'x':0.30,'y':0.40},input_filter='float')
#######################
self.etiqueta2=Label(text="RECEPCI�N" ,size_hint=(0.15,0.15),pos_hint=
{'x':0.6,'y':0.50})
self.texto9=Label(text="Altura (m.s.n.m)",size_hint=(0.05,0.05),pos_hint=
{'x':0.6,'y':0.45})
self.texto_in9=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.8,'y':0.45},input_filter='float')
self.texto10=Label(text="Latitud (�,',?)",size_hint=(0.05,0.05),pos_hint=
{'x':0.6,'y':0.40})
self.texto_in101=TextInput(text="",size_hint=(0.03,0.05),pos_hint=
{'x':0.7,'y':0.40},input_filter='float')
self.texto_in102=TextInput(text="",size_hint=(0.03,0.05),pos_hint=
{'x':0.75,'y':0.40},input_filter='float')
self.texto_in103=TextInput(text="",size_hint=(0.03,0.05),pos_hint=
{'x':0.8,'y':0.40},input_filter='float')
###########################
self.texto11=Label(text="UMBRAL DE RECEPCI�N
(dBm)",size_hint=(0.05,0.05),pos_hint= {'x':0.6,'y':0.90})
self.texto_in11=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.8,'y':0.90},input_filter='float')
self.texto12=Label(text="dN1",size_hint=(0.05,0.05),pos_hint=
{'x':0.6,'y':0.85})
self.texto_in12=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.8,'y':0.85},input_filter='float')
self.texto13=Label(text="Sa",size_hint=(0.05,0.05),pos_hint=
{'x':0.6,'y':0.80})
self.texto_in13=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.8,'y':0.80},input_filter='float')
self.texto14=Label(text="MTTR",size_hint=(0.05,0.05),pos_hint=
{'x':0.6,'y':0.75})
self.texto_in14=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.8,'y':0.75},input_filter='float')
self.texto15=Label(text="MBTF",size_hint=(0.05,0.05),pos_hint=
{'x':0.6,'y':0.70})
self.texto_in15=TextInput(text="",size_hint=(0.05,0.05),pos_hint=
{'x':0.8,'y':0.70},input_filter='float')

self.fond.add_widget(self.image1)
self.fond.add_widget(self.titulo)
self.fond.add_widget(self.boton)
self.fond.add_widget(self.texto)
self.fond.add_widget(self.texto_in)
self.fond.add_widget(self.texto1)
self.fond.add_widget(self.texto_in1)
self.fond.add_widget(self.texto2)
self.fond.add_widget(self.texto_in2)
self.fond.add_widget(self.texto3)
self.fond.add_widget(self.texto_in3)
self.fond.add_widget(self.texto4)
self.fond.add_widget(self.texto_in4)
self.fond.add_widget(self.texto5)
self.fond.add_widget(self.texto_in5)
self.fond.add_widget(self.texto6)
self.fond.add_widget(self.texto_in6)
##############
self.fond.add_widget(self.etiqueta1)
self.fond.add_widget(self.texto7)
self.fond.add_widget(self.texto_in7)
self.fond.add_widget(self.texto8)
self.fond.add_widget(self.texto_in81)
self.fond.add_widget(self.texto_in82)
self.fond.add_widget(self.texto_in83)
##################
self.fond.add_widget(self.etiqueta2)
self.fond.add_widget(self.texto9)
self.fond.add_widget(self.texto_in9)
self.fond.add_widget(self.texto10)
self.fond.add_widget(self.texto_in101)
self.fond.add_widget(self.texto_in102)
self.fond.add_widget(self.texto_in103)
####################
self.fond.add_widget(self.texto11)
self.fond.add_widget(self.texto_in11)
self.fond.add_widget(self.texto12)
self.fond.add_widget(self.texto_in12)
self.fond.add_widget(self.texto13)
self.fond.add_widget(self.texto_in13)
self.fond.add_widget(self.texto14)
self.fond.add_widget(self.texto_in14)
self.fond.add_widget(self.texto15)
self.fond.add_widget(self.texto_in15)

self.boton.bind(on_press=self.Cambiar_imagen)

return self.fond

if __name__ == '__main__':
FondApp().run()

You might also like