WIN_CLOSED bulk update. No more test for event is None, use WIN_CLOSED instead

This commit is contained in:
PySimpleGUI 2020-05-07 06:22:59 -04:00
parent 6174b355a6
commit 0076b461f5
135 changed files with 395 additions and 349 deletions

View file

@ -71,7 +71,7 @@ def main():
while True:
# --------- Read and update window --------
event, values = window.read()
if event in (None, 'Exit'):
if event in (sg.WIN_CLOSED, 'Exit'):
break
# skip mouse, control key and shift key events entirely
@ -97,7 +97,7 @@ def main():
try:
kill_proc_tree(pid=pid)
except:
sg.popup_no_wait('Error killing process', auto_close_duration=1, auto_close=True)
sg.popup_no_wait('Error killing process', auto_close_duration=2, auto_close=True, keep_on_top=True)
elif event == 'Sort by % CPU':
psutil.cpu_percent(interval=.1)
procs = psutil.process_iter()
@ -114,7 +114,7 @@ def main():
if values['-filter-'] in line.lower():
new_output.append(line)
window['-processes-'].update(new_output)
window.close()
window.close()
if __name__ == "__main__":