-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
27 lines (22 loc) · 879 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import PySimpleGUI as sg
def update_title(table, headings):
for cid, text in zip(COL_HEADINGS, headings):
table.heading(cid, text=text)
sg.theme("DarkBlue3")
newlist = [[f"Cell ({row+1}, {col+1})" for col in range(8)] for row in range(10)]
COL_HEADINGS = ["Date", "Ref", "ID", "Owner", "Customer", "Price", "Size"]
layout = [
[sg.Table(values=newlist, headings=COL_HEADINGS, max_col_width=25,
num_rows=10, alternating_row_color='green', key='-TABLE-',
enable_events=True, justification='center',)],
[sg.Button('Update')],
]
window = sg.Window('Table', layout, finalize=True)
table = window['-TABLE-'].Widget
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
elif event == 'Update':
update_title(table, ["Date", "Ref", "ID", "Owner", "Customer", "Price", "Size", "Path"])
window.close()