How do I collect value in a listbox (sg.Listbox
)? That is, when I select that line of the listbox (listbox 2, for example) with what parameters do I make the conditional?
For example:
[sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3','Listbox 4', 'Listbox 5'), key="_LISTBOX_"], [sg.Button('Option')]]
while True: # Event Loop
event, values = window.read()
if event == sg.WIN_CLOSED or event == 'Exit':
break
if event == 'Option':
print(values) #here I see the values but I have no idea what to do. !!!! ????
if values["_LISTBOX_"??????]: #??????????
print("ok")
window['-OUTPUT-'].update()