Built Table
All checks were successful
Potlatch Loggers Organization/ComputerKeeper/pipeline/head This commit looks good

This commit is contained in:
Josh Biltonen 2022-09-06 18:02:03 -07:00
parent cbfe80ac1c
commit 446befd788
2 changed files with 13 additions and 4 deletions

View File

@ -1 +1 @@
{"_default": {"1": {"Serial Number": "123", "Brand": "d", "Grade": "7", "Name": "jb"}}} {"_default": {"1": {"Serial Number": "123", "Brand": "d", "Grade": "7", "Name": "jb"}, "2": {"Serial Number": "1", "Brand": "2", "Grade": "3", "Name": "4"}}}

15
main.py
View File

@ -6,8 +6,9 @@ from tinydb import TinyDB, Query
# Define the window's contents # Define the window's contents
layout = [[sg.Menu([['File', ['Open', 'Save', 'Add Computer',]]])], colum_lut = ["Serial Number","Brand","Grade","Name"],
[sg.Table([["word","Yes"]],["Serial Number","Brand","Grade","Name"],key = "table")], layout = [[sg.Menu([['File', ['Open', 'Save', 'Add Computer',]]])]
[sg.Table([["word","Yes"]],colum_lut,key = "table")],
[sg.Text("Serial Number")], [sg.Text("Serial Number")],
[sg.Input(key='Serial Number')], [sg.Input(key='Serial Number')],
[sg.Text("Brand")], [sg.Text("Brand")],
@ -43,8 +44,16 @@ def add_computer():
def main(): def main():
"""Core of ComputerKeeper - The Main Application.""" """Core of ComputerKeeper - The Main Application."""
db= TinyDB("./db.json") db= TinyDB("./db.json")
Computer = []
for item in db.all():
print(item)
The_Device = []
for colum in colum_lut:
The_Device.append(item[colum])
Computer.append(The_Device)
# Create the window # Create the window
window = sg.Window('Window Title', layout) window = sg.Window('Window Title', layout, finalize=True)
window["table"].update(Computer)
# Display and interact with the Window using an Event Loop # Display and interact with the Window using an Event Loop
while True: while True: