Skip to content

Instantly share code, notes, and snippets.

@MikeTheWatchGuy
Created October 6, 2018 00:05
Show Gist options
  • Select an option

  • Save MikeTheWatchGuy/35bec28db1974efc84df8e899c8c0d06 to your computer and use it in GitHub Desktop.

Select an option

Save MikeTheWatchGuy/35bec28db1974efc84df8e899c8c0d06 to your computer and use it in GitHub Desktop.
Example of how to read input and show it in an another input box
import PySimpleGUI as sg
# The Window layout definition
# Pay close attention to the two Input Elements, they each have a key identifier
layout = [ [sg.Text('Test Program For StackOverflow') ],
[sg.T('Enter stuff here'), sg.Input(key='_in_')],
[sg.T('and it will show up here'), sg.Input(key='_out_')],
[ sg.Button('OK')] ]
# Make a window
window = sg.Window('My window',
default_element_size=(20,1),
auto_size_text=False,
return_keyboard_events=True,
text_justification='right').Layout(layout)
# Event loop - show window and read the input values
while True:
button, values = window.Read()
window.FindElement('_out_').Update(values['_in_']) # write whatever's in input to output
@MikeTheWatchGuy
Copy link
Copy Markdown
Author

Here is the output from the program.

stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment