-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
58 lines (38 loc) · 2.43 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from tkinter import*
from tkinter import ttk
import requests
def data_get():
city = city.get()
data = requests.get("https://api.openweathermap.org/data/2.5/weather?q="+city+"&appid=1b3ef6ac7382f89cf709631922709e20").json()
w_label1.config(text=data["weather"][0]["main"])
wb_label1.config(text=data["weather"][0]["description"])
temp_temp1.config(text=str(data["main"]["temp"]-273.15))
per_label1.config(text=data["main"]["pressure"])
win = Tk()
win.title("Weather App")
win.config(bg = "blue")
win.geometry("500x570")
name_label = Label(win, text="Weather App", font=("Time New Roman",30,"bold"))
name_label.place(x=25,y=50,height=50,width=450)
list_name = ["Andhra Pradesh","Arunachal Pradesh ","Assam","Bihar","Chhattisgarh","Goa","Gujarat","Haryana","Himachal Pradesh","Jammu and Kashmir","Jharkhand","Karnataka","Kerala","Madhya Pradesh","Maharashtra","Manipur","Meghalaya","Mizoram","Nagaland","Odisha","Punjab","Rajasthan","Sikkim","Tamil Nadu","Telangana","Tripura","Uttar Pradesh","Uttarakhand","West Bengal","Andaman and Nicobar Islands","Chandigarh","Dadra and Nagar Haveli","Daman and Diu","Lakshadweep","National Capital Territory of Delhi","Puducherry"]
com = ttk.Combobox(win,text="Weather App", values=list_name,font=("Time New Roman",30,"bold"),textvariable=city)
name_label.place(x=25,y=120,height=50,width=450)
w_label = Label(win, text="Weather Climate", font=("Time New Roman",20))
w_label.place(x=25,y=260,height=50,width=210)
w_label1 = Label(win, text="t", font=("Time New Roman",20))
w_label1.place(x=250,y=260,height=50,width=210)
wb_label = Label(win, text="Weather Description", font=("Time New Roman",17))
wb_label.place(x=25,y=330,height=50,width=210)
wb_label1 = Label(win, text="", font=("Time New Roman",17))
wb_label1.place(x=250,y=330,height=50,width=210)
temp_label = Label(win, text="Temperature", font=("Time New Roman",20))
temp_label.place(x=25,y=400,height=50,width=210)
temp_label = Label(win, text="", font=("Time New Roman",20))
temp_label.place(x=250,y=400,height=50,width=210)
per_label = Label(win, text="Pressure", font=("Time New Roman",20))
per_label.place(x=25,y=470,height=50,width=210)
per_label1 = Label(win, text="Pressure", font=("Time New Roman",20))
per_label1.place(x=250,y=470,height=50,width=210)
done_button = Button(win, text="Done", font=("Time New Roman",20,"bold"),command=data_get)
done_button.place(y=190,height=50,width=100,x=200)
win.mainloop()