Created
October 6, 2018 00:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the output from the program.