MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / settings_window

Function settings_window

DemoPrograms/Demo_User_Settings_Class.py:69–94  ·  view source on GitHub ↗

Create and interact with a "settings window". You can a similar pair of functions to your code to add a "settings" feature.

()

Source from the content-addressed store, hash-verified

67
68
69def settings_window():
70 """
71 Create and interact with a "settings window". You can a similar pair of functions to your
72 code to add a "settings" feature.
73 """
74
75 window = make_window()
76 current_theme = sg.theme()
77
78 while True:
79 event, values = window.read()
80 if event in (sg.WINDOW_CLOSED, 'Exit'):
81 break
82 if event == 'Save':
83 # Save some of the values as user settings
84 settings['-input-'] = values['-IN-']
85 settings['-theme-'] = values['-LISTBOX-'][0]
86 settings['-option1-'] = values['-CB1-']
87 settings['-option2-'] = values['-CB2-']
88 elif event == 'Settings Dictionary':
89 sg.popup(settings)
90 # if a listbox item is selected and if the theme was changed, then restart the window
91 if values['-LISTBOX-'] and values['-LISTBOX-'][0] != current_theme:
92 current_theme = values['-LISTBOX-'][0]
93 window.close()
94 window = make_window()
95
96
97def save_previous_filename_demo():

Callers 1

Calls 3

make_windowFunction · 0.70
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected