From e48dabe7f2eeb60cbd00e07c92634b641b485304 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Fri, 18 Sep 2020 13:04:01 -0400 Subject: [PATCH] Dark Grey 9 theme, slight change to error display when trying to kill self. --- DemoPrograms/Demo_psutil_Kill_Processes.py | 6 ++++-- DemoPrograms/Demo_psutil_Kill_Python_Processes.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DemoPrograms/Demo_psutil_Kill_Processes.py b/DemoPrograms/Demo_psutil_Kill_Processes.py index 521d0f49..5eaf57f8 100644 --- a/DemoPrograms/Demo_psutil_Kill_Processes.py +++ b/DemoPrograms/Demo_psutil_Kill_Processes.py @@ -7,6 +7,8 @@ import operator CONFIRM_KILLS = False + + """ Utility to show running processes, CPU usage and provides way to kill processes. Based on psutil package that is easily installed using pip @@ -46,10 +48,10 @@ def show_list_by_name(window): def main(): # ---------------- Create Form ---------------- - # sg.theme('Topanga') + sg.theme('Dark Grey 9') layout = [[sg.Text('Process Killer - Choose one or more processes', - size=(45,1), font=('Helvetica', 15), text_color='red')], + size=(45,1), font=('Helvetica', 15), text_color='yellow')], [sg.Listbox(values=[' '], size=(50, 30), select_mode=sg.SELECT_MODE_EXTENDED, font=('Courier', 12), key='-processes-')], [sg.Text('Click refresh once or twice.. once for list, second to get CPU usage')], [sg.Text('Filter by typing name', font='ANY 14'), sg.Input(size=(15,1), font='any 14', key='-filter-')], diff --git a/DemoPrograms/Demo_psutil_Kill_Python_Processes.py b/DemoPrograms/Demo_psutil_Kill_Python_Processes.py index 614bc9b6..5789d38c 100644 --- a/DemoPrograms/Demo_psutil_Kill_Python_Processes.py +++ b/DemoPrograms/Demo_psutil_Kill_Python_Processes.py @@ -97,7 +97,7 @@ def show_list_by_cpu(): def main(): # ---------------- Create Form ---------------- - # sg.theme('Topanga') + sg.theme('Dark Grey 9') layout = [[sg.Text('Python Process Killer - Choose one or more processes', size=(45, 1), font=('Helvetica', 15), text_color='yellow')], @@ -147,7 +147,8 @@ def main(): kill_proc(pid=pid) # kill_proc_tree(pid=pid) except Exception as e: - sg.popup_no_wait('Error killing process', e, auto_close_duration=2, auto_close=True, keep_on_top=True) + if event.endswith('Selected'): # only show the error if trying to kill only 1 process + sg.popup_no_wait('Error killing process', e, auto_close_duration=2, auto_close=True, keep_on_top=True) window['-processes-'].update(show_list_by_name() if name_sorted else show_list_by_cpu()) if event.endswith('Exit'): break