Better exception handling... keep the app going rather than breaking from event loop.

This commit is contained in:
PySimpleGUI 2022-09-17 10:54:42 -04:00
parent bcc799ce4a
commit 86a09c2fe0
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))