What I was wondering is if it's possible to put a timer in my program so that like every 1 min. the program will update a list box with data?
class App():
def __init__(self):
self.root = tk.Tk()
self.label = Label(text="")
self.label.pack()
self.update_clock()
self.root.mainloop()
def update_clock(self):
now = time.strftime("%H:%M:%S")
self.label.configure(text=now)
# Put Arrivals in box===============================================================
arrivallb.delete(0, END)
now = dt.datetime.now()
dte = now.strftime("%m-%d-%Y")
conn = sqlite3.connect('reservation.db')
c = conn.cursor()
c.execute("SELECT * FROM reserve")
records = c.fetchall()
for record in records:
if record[22] != "*":
if record[8] == dte:
arrivallb.insert(0, str(record[13]) + " " + record[0] + ", " + record[1])
self.root.after(10000, self.update_clock)
app=App()