From e337e54670290f74fe0c0ad5991c538c55d326b7 Mon Sep 17 00:00:00 2001 From: Ione 15 Date: Tue, 26 Mar 2024 00:33:33 +0100 Subject: [PATCH] Cleaning List on Update --- main.py | 5 +++-- todo.db | Bin 28672 -> 28672 bytes 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 43677ca..7f4c222 100644 --- a/main.py +++ b/main.py @@ -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() diff --git a/todo.db b/todo.db index 5913516e6617b9e336c4588d64da4ca5caf7cd15..976169c171afb5d8123d004f69184cee0a97f8ac 100644 GIT binary patch delta 153 zcmZp8z}WDBae_4Cp@}litcMu%$~rfu%;o3hU%kllT+lnAsUL uSy&i3QY#X33vyBwN)n5+6^zrEm=^=_{S-MSZ1P43c}8sVhH&{s3IPC8XD5yT