For example, the "Show"
event in the example below is tied to clicking the "Show"
button. Is there a way to programmatically fire off the "Show"
event without actually clicking the button? The goal is to automate clicking a series of buttons and filling text boxes by just clicking one other button instead, like a browser autofill.
import PySimpleGUI as sg
sg.theme("BluePurple")
layout = [
[sg.Text("Your typed chars appear here:"), sg.Text(size=(15, 1), key="-OUTPUT-")],
[sg.Input(key="-IN-")],
[sg.Button("Show"), sg.Button("Exit")],
]
window = sg.Window("Pattern 2B", layout)
while True: # Event Loop
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == "Exit":
break
if event == "Show":
# Update the "output" text element to be the value of "input" element
window["-OUTPUT-"].update(values["-IN-"])
window.close()