Cleaning List on Update

This commit is contained in:
Ione 15 2024-03-26 00:33:33 +01:00
parent 207e8a532a
commit e337e54670
2 changed files with 3 additions and 2 deletions

View file

@ -21,6 +21,7 @@ def remove_item():
def update_list():
listbox.delete(0,listbox.size()) # clear listbox
cur_time = (datetime.now() - datetime(1970, 1, 1)).total_seconds() + time.timezone
total_time = []
@ -37,7 +38,7 @@ def update_list():
print("UPDATE todo SET IMP = %s WHERE ID = %s" % (int(importance[i]), i + 1))
cur.execute("UPDATE todo SET IMP = %s WHERE ID = %s" % (int(importance[i]), i + 1))
print(i)
listbox.insert(tk.END, res[i][0])
listbox.insert(tk.END, res[i][1])
con.commit()
@ -62,7 +63,7 @@ remove_button = tk.Button(root, text="Remove", command=remove_item)
remove_button.pack(side=tk.LEFT, padx=5, pady=5)
update_button = tk.Button(root, text="Update", command=update_list)
update_button.pack(padx=5, pady=5)
update_button.pack(side=tk.LEFT, padx=5, pady=5)
# Run the Tkinter event loop
root.mainloop()

BIN
todo.db

Binary file not shown.