I am trying to make a GUI for my app and ran into a problem:
using PySimpleGUI
I have to define layout at first and only then display the whole window. Right now the code is like this:
import PySimpleGUI as sg
layout = [[sg.Text('Input:')],
[sg.Input(do_not_clear=False)],
[sg.Button('Read'), sg.Exit()],
[sg.Text('Alternatives:')],
[sg.Listbox(values=('value1', 'value2', 'value3'), size=(30, 2))]]
window = sg.Window('Alternative items', layout)
while True:
event, values = window.Read()
if event is None or event == 'Exit':
break
print(values[0])
window.Close()
Is it possible to only show the Listbox
after the Read
button is pushed? because I would only get values for Listbox
after my input. Maybe it somehow possible to update the listbox with new values after button event?