Merge pull request #5899 from PySimpleGUI/Dev-latest

Better exception handling... keep the app going rather than breaking …
This commit is contained in:
PySimpleGUI 2022-09-17 10:54:55 -04:00 committed by GitHub
commit bd0d18b380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -280,12 +280,13 @@ def main(refresh_rate, win_location):
window = create_window(win_location, settings)
try:
while True: # Event Loop
event, values = window.read(timeout=refresh_in_milliseconds)
if event in (None, '-QUIT-', 'Exit', sg.WIN_CLOSE_ATTEMPTED_EVENT):
sg.user_settings_set_entry('-win location-', window.current_location()) # The line of code to save the position before exiting
break
try:
if event == '-CHANGE-':
x, y = window.current_location()
settings = change_settings(settings, (x + 200, y+50))