I made several changes today. I noticed that the Max temperature query was looking at all of the temperatures in the database not just a single sensor. So I changed the query to just query the RearDeck sensor. I also changed the query to automatically get today's date and not hardcode the date.
import datetime import time import MySQLdb from tkinter import * from tkinter.ttk import * window =Tk() window.title("Pylearn Day 4") window.geometry('1024x768') lbl = Label(window, text="day 4", font=("Arial Bold", 50)) lbl.pack() querydate = str(datetime.date.today()) def clicked2(): db = MySQLdb.connect("192.168.1.200", "pidata", "Rasp!data99", "home_data") cursor = db.cursor() sqlcmd = "select max(temp) from temperatures where tempTime like '" + querydate + "%' and location like 'RearDeck';" cursor.execute(sqlcmd) row = cursor.fetchone() lbl.configure(text= querydate + " Max Temp " + str(row), font=("Arial Bold", 24)) db.close() button_2 = Button(window, text="Click for max temp", command=clicked2) button_2.pack() window.mainloop()