Python - sg.Listbox(values.......????

 
Vista:
Imágen de perfil de Fran

sg.Listbox(values.......????

Publicado por Fran (3 intervenciones) el 01/10/2021 16:46:14
Hello,

Easy question,

in a listbox,( sg.Listbox ) how do I collect value? , that is, when I select that line of the listbox (listbox 2, for example) with what parameters do I make the conditional?
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()


Thanks in advance
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder