1import PySimpleGUI as sg
2
3def func(message):
4 print(message)
5
6layout = [[sg.Button('1'), sg.Button('2'), sg.Exit()] ]
7
8window = sg.Window('ORIGINAL').Layout(layout)
9
10while True: # Event Loop
11 event, values = window.Read()
12 if event in (None, 'Exit'):
13 break
14 if event == '1':
15 func('Pressed button 1')
16 elif event == '2':
17 func('Pressed button 2')
18window.Close()
19