Quantcast
Viewing all articles
Browse latest Browse all 14360

Is there a way to read the values property of a PySimpleGUI combobox?

I have created a PySimpleGUI combo box with code which simplifies down to:

combo_list = ['Choice 1', 'Choice 2']    layout = [[sg.Combo(combo_list, default_value=combo_list[0], key='-COMBO-', enable_events=True)]]

The user is able to add items to the drop-down list, and when he quits the app, I save the updated combo_list so that it can be used when the program is next run. At the moment I am doing this by adding any new entries made by the user, to my combo_list array. But is there a way to simply read back the updated parameter 'values' from the Combo element itself rather than having to shadow it by updating the combo_list array?

There is no problem reading back the value that the user has chosen using window['-COMBO-'].get(), but in spite of checking the PySimpleGUI docs, and more generally, I have not been able to find a way to read the list of values. If this is not possible, I will continue to update the combo_list array whenever the user adds an item. But it would be good to know.


Viewing all articles
Browse latest Browse all 14360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>