Window title change, sorted the entries before displaying

This commit is contained in:
PySimpleGUI 2020-10-16 14:28:31 -04:00
parent 5843f33d28
commit 2652701540
1 changed files with 2 additions and 3 deletions

View File

@ -10,14 +10,13 @@ import PySimpleGUI as sg
Copyright 2020 PySimpleGUI.org
"""
def main():
layout = [[sg.T('This is your layout')],
[sg.T('Enter or choose name'), sg.Combo(sg.user_settings_get_entry('names', []), size=(20,1), k='-COMBO-')],
[sg.T('Enter or choose name'), sg.Combo(sorted(sg.user_settings_get_entry('names', [])), size=(20,1), k='-COMBO-')],
[sg.OK(), sg.Button('Exit')]]
event, values = sg.Window('Pattern for theme saving', layout).read(close=True)
event, values = sg.Window('Pattern for saving with Combobox', layout).read(close=True)
if event == 'OK':
sg.user_settings_set_entry('names', list(set(sg.user_settings_get_entry('names', []) + [values['-COMBO-'],])))