Callbacks untuk berfungsi pysimplui
import PySimpleGUI as sg
def func(message):
print(message)
layout = [[sg.Button('1', key=lambda: func('Pressed Button 1')), sg.Button('2'), sg.Exit()] ]
window = sg.Window('Func Calls Based on Buttons', layout)
while True: # Event Loop
event, values = window.read()
if event in (sg.WIN_CLOSED, 'Exit'):
break
if callable(event):
event()
elif event == '2':
func('Pressed button 2')
window.close()
Mike From PySimpleGUI