From 801d3b4b1dcda67e4be1a2142e4f84e3588b24a5 Mon Sep 17 00:00:00 2001 From: Josh b Date: Sun, 25 Sep 2022 19:15:15 -0700 Subject: [PATCH] enabled it to remove things --- db.json | 2 +- main.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/db.json b/db.json index 13d8763..1fa0494 100644 --- a/db.json +++ b/db.json @@ -1 +1 @@ -{"_default": {"1": {"Serial Number": "123", "Brand": "d", "Grade": "7", "Name": "jb"}, "2": {"Serial Number": "1", "Brand": "2", "Grade": "3", "Name": "4"}, "3": {"Serial Number": "4321", "Brand": "d", "Grade": "12", "Name": "qb"}}} \ No newline at end of file +{"_default": {"1": {"Serial Number": "123", "Brand": "d", "Grade": "7", "Name": "jb"}, "2": {"Serial Number": "1", "Brand": "2", "Grade": "3", "Name": "4"}}} \ No newline at end of file diff --git a/main.py b/main.py index 540809f..3fe2397 100644 --- a/main.py +++ b/main.py @@ -69,7 +69,9 @@ def main(): elif event == 'Remove Computer': if values["table"]: existing_table = window["table"].get() - existing_table.pop(values["table"][0]) + serial = existing_table.pop(values["table"][0])[0] + query = Query() + db.remove(query["Serial Number"] == serial) window["table"].update(existing_table) # Finish up by removing from the screen