from tkinter import *
import tkinter as tk
from [Link] import Nominatim
from tkinter import ttk,messagebox
from timezonefinder import TimezoneFinder
from datetime import datetime
import requests
import pytz
root=Tk()
[Link]("Weather App")
[Link]("800x400+200+100")
[Link](False,False)
def getWeather():
try:
city=text_field.get()
geolocator=Nominatim(user_agent="geoapiExercises")
location=[Link](city)
obj=TimezoneFinder()
result=obj.timezone_at(lng=[Link],lat=[Link])
print(result)
home=[Link](result)
local_time=[Link](home)
current_time=local_time.strftime("%I:%M %p")
[Link](text=current_time)
[Link](text="CURRENT WEATHER")
# Add API Key Weather
api="[Link]
q="+city+"&appid=b22d362851862b"
json_data=[Link](api).json()
[Link](text=str(json_data['main']['temp'] - 273.15))
[Link](text=json_data['weather'][0]['main'])
[Link](text=json_data['wind']['speed'])
[Link](text=json_data['main']['humidity'])
[Link](text=json_data['weather'][0]['description'])
[Link](text=json_data['main']['pressure'])
except Exception as e:
[Link]("Weather App","Invalid Entry!!")
#Add Search Bar
image_search=PhotoImage(file="C:\\Users\\Sandy\\Downloads\\images (1).jpeg")
searchbar_image=Label(image=image_search)
searchbar_image.place(x=10,y=10)
text_field=[Link](root,justify="center",width=17,font=("poppins",18,"bold"),bg="#
147886",border=0,fg="white")
text_field.place(x=20,y=20)
text_field.focus()
#Add Search Icon
image_search_icon=PhotoImage(file="C:\\Users\\Sandy\\Downloads\\images (1).jpeg")
search_icon=Button(image=image_search_icon,borderwidth=0,cursor="hand2",bg="#147886
",command=getWeather)
search_icon.place(x=250,y=18)
#Add Weather Logo
image_logo=PhotoImage(file="C:\\Users\\Sandy\\Downloads\\images (1).jpeg")
weather_logo=Label(image=image_logo)
weather_logo.place(x=250,y=90)
#Add Information Box
image_box=PhotoImage(file="C:\\Users\\Sandy\\Downloads\\images (1).jpeg")
information_box=Label(image=image_box)
information_box.pack(padx=5,pady=5,side=BOTTOM)
#Time
name=Label(root,font=("arial",15,"bold"))
[Link](x=30,y=100)
clock=Label(root,font=("Merriweather",20))
[Link](x=30,y=130)
#Label
label1=Label(root,text="WIND",font=("Merriweather",15,"bold"),fg="White",bg="#5AC9D
9")
[Link](x=100,y=330)
label2=Label(root,text="HUMIDITY",font=("Merriweather",15,"bold"),fg="White",bg="#5
AC9D9")
[Link](x=210,y=330)
label3=Label(root,text="DESCRIPTION",font=("Merriweather",15,"bold"),fg="White",bg=
"#5AC9D9")
[Link](x=360,y=330)
label4=Label(root,text="PRESSURE",font=("Merriweather",15,"bold"),fg="White",bg="#5
AC9D9")
[Link](x=570,y=330)
t=Label(font=("arial",50,"bold"),fg="#ee666d")
[Link](x=400,y=150)
c=Label(font=("arial",20,"bold"))
[Link](x=420,y=230)
w=Label(text="...",font=("arial",16,"bold"),bg="#5AC9D9")
[Link](x=110,y=360)
h=Label(text="...",font=("arial",16,"bold"),bg="#5AC9D9")
[Link](x=230,y=360)
d=Label(text="...",font=("arial",16,"bold"),bg="#5AC9D9")
[Link](x=370,y=360)
p=Label(text="...",font=("arial",16,"bold"),bg="#5AC9D9")
[Link](x=590,y=360)
[Link]()