How to select a cell within a table?

Viewed 2169

I'm displaying a Pandas dataframe with PysimpleGUI and the user has to check wether the displayed Data is actually Correct. And If not he can change the value.

I found this code as starting Point:

https://repl.it/@PySimpleGUI/Table-Element

Personally I don't use the Web-Version but PysimpleGUI.

I get the following error-message:

When I use the following code my Statement in the GUI becomes:

window['_selected_value_'].Update(window.Element('table').SelectedItem) AttributeError: 'Table' object has no attribute 'SelectedItem'

When I change the code to the one below, I get the following display:

PySimpleGUI.PySimpleGUI.Window object at 0x1252b5390

What I'd like to See/Get is the cell value e.g. 7 so I then can change it with user-input.

Thank you

while True:
    event, values = window.Read()
    for value in values:
        print(value)
    if event in (None, 'Exit'):
        break
    window['_selected_rows_'].Update(values['_table_'])
    window['_selected_value_'].Update(window.Element('_table_'))

What I'd like to See/Get is the cell value e.g. 7 so I then can change it with user-input.

Thank you very much.

1 Answers

Here is an example to simulate table by using Input matrix. Each input has a key of (i, j). use values[(i,j)] to call the value in the cell.

[sg.Input(size=(10, 1), pad=(1, 1), justification='right', key=(i, j)) for j in range(MAX_COL)] for i in range(MAX_ROWS)]
Related