Renamed the user settings key for window location to '-location-'

This commit is contained in:
PySimpleGUI 2021-08-15 17:53:35 -04:00
parent 42a8dc69b2
commit 3b093e1c4a
1 changed files with 2 additions and 2 deletions

View File

@ -17,13 +17,13 @@ import PySimpleGUI as sg
layout = [[sg.Text('Window that Auto-saves position', font='_ 25')], layout = [[sg.Text('Window that Auto-saves position', font='_ 25')],
[sg.Button('Ok'), sg.Button('Exit')]] [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: while True:
event, values = window.read() event, values = window.read()
print(event, values) print(event, values)
if event in ('Exit', sg.WINDOW_CLOSE_ATTEMPTED_EVENT): 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 break
window.close() window.close()