I want pysimplegui to do the following:
- read a number I input in an InputText;
- store that number in a variable "n" that then is used to search for a specific element in an Excel sheet;
- return value adjacent to the "n" variable from the Excel sheet and display it in a TextBox in the same window.
So far, I managed to get the GUI to display the number I input in one box into another box from that same window, but not sure how to first run that number through a piece of code so that it returns something else in the second TextBox.
import PySimpleGUI as sg
sg.theme('DarkAmber')
layout = [
[sg.Text("Enter Avaya Code")],
[sg.InputText("", key="avaya", size=(20, 3), do_not_clear=True)],
[sg.Text("Enter Extension")],
[sg.InputText("", key="extension", size=(20, 3), do_not_clear=True)],
[sg.Button("Search", size=(7, 2))]]
window = sg.Window("Search").Layout(layout)
while True:
event, values = window.Read()
if event == "Search":
window.FindElement("extension").Update(values["avaya"])```
Any suggestions?