2

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.

Hirschdude
  • 127
  • 3
  • 10
  • 1
    You can't really select an individual cell using a table element. You can simulate a table, or you can modify a table via some other means and then resubmit the table to be displayed using Update. – Mike from PSG Oct 13 '19 at 01:16
  • 1
    Oh, Qt is the exception. The Table element in Qt WILL allow you to edit it and read the values back again. – Mike from PSG Oct 13 '19 at 01:17

1 Answers1

1

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)]
David Buck
  • 3,752
  • 35
  • 31
  • 35