Horje
callbacks to function pysimplegui Code Example
callbacks to function pysimplegui
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()
callbacks to function pysimplegui
import PySimpleGUI as sg

def func(message):
    print(message)

layout = [[sg.Button('1'), sg.Button('2'), sg.Exit()] ]

window = sg.Window('ORIGINAL').Layout(layout)

while True:             # Event Loop
    event, values = window.Read()
    if event in (None, 'Exit'):
        break
    if event == '1':
        func('Pressed button 1')
    elif event == '2':
        func('Pressed button 2')
window.Close()




Python

Related
python code with sigma Code Example python code with sigma Code Example
auto instagram login Code Example auto instagram login Code Example
Compute the variance of this RDD’s elements Code Example Compute the variance of this RDD’s elements Code Example
python django creating products Code Example python django creating products Code Example
python check if attribute exists in dictionary Code Example python check if attribute exists in dictionary Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7