You can set your js to refresh every once in a while to recover the latest data from the database. Create a dataset to read the results from the db, and another one to store the one that was used last, and compare the new one with the last one used. If changed, update the values in your page, else, don't do anything.
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: