Better exception handling... keep the app going rather than breaking from event loop.
This commit is contained in:
parent
bcc799ce4a
commit
86a09c2fe0
|
@ -280,12 +280,13 @@ def main(refresh_rate, win_location):
|
||||||
|
|
||||||
window = create_window(win_location, settings)
|
window = create_window(win_location, settings)
|
||||||
|
|
||||||
try:
|
|
||||||
while True: # Event Loop
|
while True: # Event Loop
|
||||||
event, values = window.read(timeout=refresh_in_milliseconds)
|
event, values = window.read(timeout=refresh_in_milliseconds)
|
||||||
if event in (None, '-QUIT-', 'Exit', sg.WIN_CLOSE_ATTEMPTED_EVENT):
|
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
|
sg.user_settings_set_entry('-win location-', window.current_location()) # The line of code to save the position before exiting
|
||||||
break
|
break
|
||||||
|
try:
|
||||||
if event == '-CHANGE-':
|
if event == '-CHANGE-':
|
||||||
x, y = window.current_location()
|
x, y = window.current_location()
|
||||||
settings = change_settings(settings, (x + 200, y+50))
|
settings = change_settings(settings, (x + 200, y+50))
|
||||||
|
|
Loading…
Reference in New Issue