Renamed the user settings key for window location to '-location-'
This commit is contained in:
parent
42a8dc69b2
commit
3b093e1c4a
|
@ -17,13 +17,13 @@ import PySimpleGUI as sg
|
|||
layout = [[sg.Text('Window that Auto-saves position', font='_ 25')],
|
||||
[sg.Button('Ok'), sg.Button('Exit')]]
|
||||
|
||||
window = sg.Window('Auto-saves Location', layout, enable_close_attempted_event=True, location=sg.user_settings_get_entry('-position-', (None, None)))
|
||||
window = sg.Window('Auto-saves Location', layout, enable_close_attempted_event=True, location=sg.user_settings_get_entry('-location-', (None, None)))
|
||||
|
||||
while True:
|
||||
event, values = window.read()
|
||||
print(event, values)
|
||||
if event in ('Exit', sg.WINDOW_CLOSE_ATTEMPTED_EVENT):
|
||||
sg.user_settings_set_entry('-position-', window.current_location()) # The line of code to save the position before exiting
|
||||
sg.user_settings_set_entry('-location-', window.current_location()) # The line of code to save the position before exiting
|
||||
break
|
||||
|
||||
window.close()
|
||||
|
|
Loading…
Reference in New Issue