MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / make_window

Function make_window

DemoPrograms/Demo_psutil_Kill_Python_Processes.py:101–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99
100
101def make_window():
102 layout = [[sg.Text('Python Process Killer - Choose one or more processes',
103 size=(45, 1), font=('Helvetica', 15), text_color='yellow')],
104 [sg.Listbox(values=[' '], size=(130, 30), select_mode=sg.SELECT_MODE_EXTENDED, font=('Courier', 10), key='-PROCESSES-', expand_x=True, expand_y=True)],
105 [sg.Text('Click refresh once or twice.. once for list, second to get CPU usage')],
106 [sg.Text('Filter by typing name', font='ANY 14'), sg.Input(size=(15, 1), font='any 14', key='-FILTER-', enable_events=True),
107 sg.Checkbox('Show only Python processes', default=True, enable_events=True, key='-PYTHON ONLY-')],
108 [sg.Button('Sort by Name', ),
109 sg.Button('Sort by % CPU', button_color=('white', 'DarkOrange2')),
110 sg.Button('Show Open Files', button_color=('white', 'dark green')),
111 sg.Button('Kill Selected', button_color=('white', 'red'), bind_return_key=True),
112 sg.Button('Kill All', button_color='red on white'),
113 sg.Button('Kill All & Exit', button_color='red on white'),
114 sg.Exit(button_color=('white', 'sea green')), sg.Sizegrip()]]
115
116 window = sg.Window('Python Process Killer', layout,
117 keep_on_top=True,
118 auto_size_buttons=False,
119 default_button_element_size=(12, 1),
120 return_keyboard_events=True,
121 resizable=True,
122 right_click_menu=sg.MENU_RIGHT_CLICK_EDITME_EXIT,
123 finalize=True)
124 window.bind('<Delete>', 'Kill Selected')
125 window.set_min_size(window.size)
126 return window
127
128def kill_all(python_only=True):
129 processes_to_kill = show_list_by_name(python_only=python_only)

Callers 1

mainFunction · 0.70

Calls 2

bindMethod · 0.95
set_min_sizeMethod · 0.95

Tested by

no test coverage detected