I am trying to make a simple program that gets information off an API and displays it on python GUI with tkinter.
So far I have been able to do this but a new challenge is getting the information collected from the API to refresh every hour.
Basically I need the data() function to be re-run every hour so that the information on the GUI updates.
from tkinter import *
import requests
def data():
url = requests.get("https://stats.foldingathome.org/api/donor/PointofHorizon")
json = str((url.json()))
i = json.count(',')
data = json.split(",")
score = data[i]
score = score.replace(" 'credit': ","")
score = score.replace("}","")
unit = data[0]
unit = unit.replace("{'wus': ","")
scores = Label(app, text = score)
units = Label(app, text = unit)
scores.pack()
units.pack()
app = Tk()
app.geometry("500x200")
title = Label(app,text = "Folding Score")
title.pack()
I have looked around and haven't been able to find a way that works for me, would be amazing if someone could point me in the right direction. I'm still learning and all.
import *is generally bad practice.