Sep-10-2021, 03:51 AM
Hello, I just started trying to learn programming 3 days ago. I'm following online courses and researching about 4-6 hours a day. I'm one of those who has to learn by doing and making mistakes so I started making an app that will log weather temps current, min/max each day as well as barometric pressure and humidity because I have Meniere's Disease and this affects it greatly. Would also help many others if they used it. I have just started and I don't know how to store the data as it comes in from the weather api and then record it in the app. Any help would be appreciated.
import tkinter as tk import requests import time def getWeather(): location = textfield.get() #https://api.openweathermap.org/data/2.5/weather?q=Winnsboro,Louisiana&appid=xxxxxxxxxxx api = "api.openweathermap.org/data/2.5/weather?q=" + city + state + "&appid=xxxxxxxxxxx" json_data = requests.get(api).json() condition = json_data['weather'][0]['main'] temp = int(json_data['main']['temp']) max_temp = int(json_data['main']['temp_max']) min_temp = int(json_data['main']['temp_min']) press = int(json_data['main']['pressure']) #max_press = int(json_data['main']['pressure_max']) #min_press = int(json_data['main']['pressure_min']) humidity = int(json_data['main']['humidity']) canvas = tk.Tk() canvas.geometry("960x600") canvas.title("Meniers App") f = ("poppins", 20,) t = ("poppins", 25, "bold") textfield = tk.Entry(canvas, font = t) textfield.pack(pady = 25) textfield.focus()Thanks in advance.