finished the last two weather cards

This commit is contained in:
2026-07-26 15:09:06 +02:00
parent 4fb574fe52
commit 71ffae0026
+35 -4
View File
@@ -143,12 +143,15 @@ def get_current_color(widget="CTkFrame"):
def checkSystem():
global degrees
global speed
if system == "metric":
degrees = "°C"
speed = "m/s"
changeFromMetric.set(False)
elif system == "imperial":
degrees = "°F"
speed = "mph"
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_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.pack(side="left", expand=True, fill="both", padx=10)
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 ####
@@ -345,16 +360,32 @@ def searchWeather():
feels_like = data["main"]["feels_like"]
maxTemp = data["main"]["temp_max"]
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():
ErrorLabel.configure(text="")
ErrorFrame.pack_forget()
weatherTempLabel.configure(
text=f"It is {temp}{degrees} in {city}. \n\n"
f"It feels like {feels_like}{degrees} and the \n\n"
f"max Temperature is {maxTemp}{degrees}, while\n\n"
f"the minimum Temperature is {minTemp}{degrees}"
text=f"The current temperature in {city}\n\n is {temp}{degrees}. \n\n"
f"It actually feels like {feels_like}{degrees} and today's \n\n"
f"temperature will drop to a minimum of {minTemp}{degrees},\n\n"
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()
resultPage.pack(fill="both", expand=True)