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

Function main

DemoPrograms/Demo_Save_Window_As_Image.py:32–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30
31
32def main():
33
34 col = [[sg.Text('This is the first line')],
35 [sg.In()],
36 [sg.Button('Save'), sg.Button('Exit')]]
37
38 layout = [[sg.Column(col, key='-COLUMN-')]] # put entire layout into a column so it can be saved
39
40 window = sg.Window("Drawing and Moving Stuff Around", layout)
41
42 while True:
43 event, values = window.read()
44 if event in (sg.WIN_CLOSED, 'Exit'):
45 break # exit
46 elif event == 'Save':
47 filename = sg.popup_get_file('Choose file (PNG, JPG, GIF) to save to', save_as=True)
48 save_element_as_file(window['-COLUMN-'], filename)
49
50 window.close()
51
52main()

Callers 1

Calls 3

readMethod · 0.95
closeMethod · 0.95
save_element_as_fileFunction · 0.70

Tested by

no test coverage detected