Update a layout of a column in PySimpleGUI

62 Views Asked by At

I have a GUI environment to list actions of an UPnP device. The GUI has on the left side a TreeData and the right side an output console to display the values of the TreeData. The code of the layout is this:

mainWindowlayout = [
        [
            sg.Menu(menu),
            sg.Text("UPnP console", font=('Roboto', 30))

        ],
        [
            sg.Text(f'Device: {selectedDevice}', key="_DEVICE_", font=('Roboto', 20))
        ],
        [
            sg.Tree(key='-Device Tree-',
                auto_size_columns=True,
                headings=['',],
                select_mode=sg.TABLE_SELECT_MODE_EXTENDED,
                data=loadDeviceTree(globals()['device']),
                enable_events=True,
                expand_x=True,
                expand_y=True,
                ),
            sg.Col([
                [sg.Output(s=(120, 50), key='-OUTPUT-')]
                ], key="-DATA COL-")
        ]
    ]

GUI console

My goal is to update the column where the output is to then be able to receive inputs, basically update the layout that is inside the column to a new one.

The code that i'm using is basically useless when it comes to do that, the only useful thing would be the fact that the things i want to convert to a layout are inside a dict.

I've tried to use this lines to do that, with no result:

if event=='-Device Tree-':
    selected_value = values['-Device Tree-'][0] if values['-Device Tree-'] else None
    window['-DATA COL-'].update('')
0

There are 0 best solutions below