finished the last two weather cards
This commit is contained in:
@@ -143,12 +143,15 @@ def get_current_color(widget="CTkFrame"):
|
|||||||
def checkSystem():
|
def checkSystem():
|
||||||
|
|
||||||
global degrees
|
global degrees
|
||||||
|
global speed
|
||||||
if system == "metric":
|
if system == "metric":
|
||||||
degrees = "°C"
|
degrees = "°C"
|
||||||
|
speed = "m/s"
|
||||||
changeFromMetric.set(False)
|
changeFromMetric.set(False)
|
||||||
|
|
||||||
elif system == "imperial":
|
elif system == "imperial":
|
||||||
degrees = "°F"
|
degrees = "°F"
|
||||||
|
speed = "mph"
|
||||||
changeFromMetric.set(True)
|
changeFromMetric.set(True)
|
||||||
|
|
||||||
|
|
||||||
@@ -305,10 +308,22 @@ weatherGeneralFrame = ctk.CTkFrame(cardsFrame, width=500, height=350)
|
|||||||
weatherGeneralFrame.pack(side="left", expand=True, fill="both", padx=10)
|
weatherGeneralFrame.pack(side="left", expand=True, fill="both", padx=10)
|
||||||
weatherGeneralFrame.pack_propagate(False)
|
weatherGeneralFrame.pack_propagate(False)
|
||||||
|
|
||||||
|
weatherGeneralTitle = ctk.CTkLabel(weatherGeneralFrame, text="General:", font=("Arial", 45, "bold"))
|
||||||
|
weatherGeneralTitle.pack(expand=True, fill="both", pady=(20,10))
|
||||||
|
|
||||||
|
weatherGeneralLabel = ctk.CTkLabel(weatherGeneralFrame, font=("Arial", 25))
|
||||||
|
weatherGeneralLabel.pack(expand=True, anchor = "n")
|
||||||
|
|
||||||
weatherWindFrame = ctk.CTkFrame(cardsFrame, width=500, height=350)
|
weatherWindFrame = ctk.CTkFrame(cardsFrame, width=500, height=350)
|
||||||
weatherWindFrame.pack(side="left", expand=True, fill="both", padx=10)
|
weatherWindFrame.pack(side="left", expand=True, fill="both", padx=10)
|
||||||
weatherWindFrame.pack_propagate(False)
|
weatherWindFrame.pack_propagate(False)
|
||||||
|
|
||||||
|
weatherWindTitle = ctk.CTkLabel(weatherWindFrame, text="Wind", font=("Arial", 45, "bold"))
|
||||||
|
weatherWindTitle.pack(expand=True, fill="both", pady=(20,10))
|
||||||
|
|
||||||
|
weatherWindLabel = ctk.CTkLabel(weatherWindFrame, font=("Arial", 25))
|
||||||
|
weatherWindLabel.pack(expand=True, anchor = "n")
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
#### Return Button ####
|
#### Return Button ####
|
||||||
@@ -345,16 +360,32 @@ def searchWeather():
|
|||||||
feels_like = data["main"]["feels_like"]
|
feels_like = data["main"]["feels_like"]
|
||||||
maxTemp = data["main"]["temp_max"]
|
maxTemp = data["main"]["temp_max"]
|
||||||
minTemp = data["main"]["temp_min"]
|
minTemp = data["main"]["temp_min"]
|
||||||
|
pressure = data["main"]["grnd_level"] / 1000
|
||||||
|
humidity = data["main"]["humidity"]
|
||||||
|
windSpeed = data["wind"]["speed"]
|
||||||
|
windDirection = data["wind"]["deg"]
|
||||||
|
|
||||||
|
|
||||||
|
print(data)
|
||||||
|
|
||||||
def show_result():
|
def show_result():
|
||||||
ErrorLabel.configure(text="")
|
ErrorLabel.configure(text="")
|
||||||
ErrorFrame.pack_forget()
|
ErrorFrame.pack_forget()
|
||||||
|
|
||||||
weatherTempLabel.configure(
|
weatherTempLabel.configure(
|
||||||
text=f"It is {temp}{degrees} in {city}. \n\n"
|
text=f"The current temperature in {city}\n\n is {temp}{degrees}. \n\n"
|
||||||
f"It feels like {feels_like}{degrees} and the \n\n"
|
f"It actually feels like {feels_like}{degrees} and today's \n\n"
|
||||||
f"max Temperature is {maxTemp}{degrees}, while\n\n"
|
f"temperature will drop to a minimum of {minTemp}{degrees},\n\n"
|
||||||
f"the minimum Temperature is {minTemp}{degrees}"
|
f"while the maximum temperature expected \n\n today is {maxTemp}{degrees}"
|
||||||
|
)
|
||||||
|
weatherGeneralLabel.configure(
|
||||||
|
text=f"The atmospheric pressure measured at ground \n\n"
|
||||||
|
f"level is {pressure} bar. \n\n"
|
||||||
|
f"The current relative air humidity stands at {humidity}%"
|
||||||
|
)
|
||||||
|
weatherWindLabel.configure(
|
||||||
|
text=f"The wind is currently blowing at a \n\n speed of {windSpeed}{speed}.\n\n"
|
||||||
|
f"The wind direction is coming from {windDirection}°."
|
||||||
)
|
)
|
||||||
searchPage.pack_forget()
|
searchPage.pack_forget()
|
||||||
resultPage.pack(fill="both", expand=True)
|
resultPage.pack(fill="both", expand=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user