Skip to content

Commit 01156c8

Browse files
authored
Update main.py
1 parent 8dd250b commit 01156c8

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

Aplicacion Meteorológica/main.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,21 @@
1010
class Ventana(Frame):
1111
def __init__(self, master, *args):
1212
super().__init__( master,*args)
13-
1413
self.click = True
15-
14+
1615
self.master.columnconfigure(0, weight=1)
1716
self.master.columnconfigure(1, weight=1)
1817
self.master.rowconfigure(1, weight=1)
1918
self.master.columnconfigure(2, weight=1)
2019
self.master.rowconfigure(2, weight=1)
21-
2220
self.frame = Frame(self.master, bg='white', highlightbackground='deep pink',highlightthickness=2)
2321
self.frame.grid(columnspan=3, row = 0, sticky='nsew', padx=5, pady=5)
24-
2522
self.frame2 = Frame(self.master, bg='pale green', highlightbackground='dark violet',highlightthickness=2)
2623
self.frame2.grid(column=0, row = 1, sticky='nsew', padx=5, pady=5)
2724
self.frame3 = Frame(self.master, bg='SeaGreen1', highlightbackground='dark violet',highlightthickness=2) #pink
2825
self.frame3.grid(column=1, row = 1, sticky='nsew', padx=5, pady=5)
2926
self.frame4 = Frame(self.master, bg='PaleTurquoise1', highlightbackground='dark violet',highlightthickness=2)
3027
self.frame4.grid(column=2, row = 1, sticky='nsew', padx=5, pady=5)
31-
3228
self.frame5 = Frame(self.master, bg='cyan2', highlightbackground='dark violet',highlightthickness=2) #light coral
3329
self.frame5.grid(column=0, row = 2, sticky='nsew', padx=5, pady=5)
3430
self.frame6 = Frame(self.master, bg='aquamarine', highlightbackground='dark violet',highlightthickness=2)
@@ -47,10 +43,8 @@ def animacion(self):
4743
self.frame6.config(highlightbackground='red')
4844
self.frame7.config(highlightbackground='red')
4945
self.obtener_tiempo()
50-
5146
gif = Image.open('buscar.gif')
5247
frames = gif.n_frames
53-
5448
if self.click == True:
5549
for i in range(1, frames):
5650
self.inicio = PhotoImage(file ='buscar.gif', format='gif -index %i' %(i))
@@ -59,17 +53,14 @@ def animacion(self):
5953
self.master.update()
6054
self.click= False
6155
if i + 1 == frames:
62-
self.click = True
63-
64-
56+
self.click = True
6557
def obtener_tiempo(self):
6658
ciudad = self.ingresa_ciudad.get()
67-
#key : 'f08c20ee319398d4ccb55d6a775da822'
59+
#key : 'f08c20ee319398d4ccb55d6a775da82211'
6860
#API = 'api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key}'
6961

7062
#Actualizar la API key con la de su cuenta:
71-
API = 'https://api.openweathermap.org/data/2.5/weather?q=' +ciudad+ '&appid=f08c20ee319398d4ccb55d6a775da822'
72-
63+
API = 'https://api.openweathermap.org/data/2.5/weather?q=' +ciudad+ '&appid=f08c20ee319398d4ccb55d6a775da82211'
7364
try:
7465
json_datos = requests.get(API).json()
7566
self.temp['text'] = str(int(json_datos['main']['temp'] - 273.15)) + " °C"
@@ -91,9 +82,7 @@ def obtener_tiempo(self):
9182
self.master.update()
9283
time.sleep(1)
9384
self.aviso['text'] = ''
94-
self.localidad['text'] = ''
95-
96-
85+
self.localidad['text'] = ''
9786
def widgets(self):
9887
self.inicio = PhotoImage(file ='buscar.gif')
9988
self.imagen_temp = PhotoImage(file ='temperatura.png')
@@ -102,7 +91,6 @@ def widgets(self):
10291
self.imagen_humedad = PhotoImage(file ='humedad.png')
10392
self.imagen_viento = PhotoImage(file ='viento.png')
10493
self.imagen_presion = PhotoImage(file ='presion.png')
105-
10694
self.bt_inicio = Button(self.frame, image= self.inicio, bg='red',highlightthickness=0, activebackground='white', bd=0, command = self.animacion)
10795
self.bt_inicio.grid(column=0, row=0, padx=2, pady=2)
10896
self.ingresa_ciudad = Entry(self.frame, font=('Comic Sans MS', 12),highlightbackground = "DarkOrchid1", highlightcolor= "green2", highlightthickness=2)

0 commit comments

Comments
 (0)