MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / main

Function main

DemoPrograms/Demo_Desktop_Widget_Launcher_Bar.py:87–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86
87def main():
88 window = make_window()
89
90 while True:
91 event, values = window.read(timeout=1000) # Not needed but handy while debugging
92 # print(event, values)
93 if event in (sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit', sg.WIN_CLOSED):
94 if event != sg.WIN_CLOSED:
95 if sg.user_settings_get_entry('-auto save location-', True):
96 print('saving locatoin', window.current_location())
97 sg.user_settings_set_entry('-window location-', window.current_location())
98 break
99 if event in launcher_buttons:
100 action = window[event].metadata
101 if isinstance(action, str):
102 if action.endswith(('.py', '.pyw')):
103 sg.execute_py_file(action)
104 else:
105 sg.execute_command_subprocess(action)
106 elif callable(action):
107 action()
108 if event == 'Edit Me':
109 sg.execute_editor(__file__)
110 elif event == 'Version':
111 sg.popup_scrolled(sg.get_versions())
112 elif event == 'Settings':
113 settings(window)
114 window.close()
115 window = make_window()
116 elif event == sg.SYMBOL_DOWN_ARROWHEAD:
117 window['-BUTTON COL-'].update(visible=False)
118 window['-MINIMIZED COL-'].update(visible=True)
119 elif event == '-MINIMIZED IMAGE-':
120 window['-BUTTON COL-'].update(visible=True)
121 window['-MINIMIZED COL-'].update(visible=False)
122 window.close()
123
124
125if __name__ == '__main__':

Calls 6

settingsFunction · 0.85
current_locationMethod · 0.80
make_windowFunction · 0.70
readMethod · 0.45
closeMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected