Skip to content

Instantly share code, notes, and snippets.

@MikeTheWatchGuy
Created September 18, 2018 18:02
Show Gist options
  • Save MikeTheWatchGuy/b7eaa2fa42cd65a4f2b13aa2412d6600 to your computer and use it in GitHub Desktop.
Save MikeTheWatchGuy/b7eaa2fa42cd65a4f2b13aa2412d6600 to your computer and use it in GitHub Desktop.
Reddit problem posted by hackintoshguy
import PySimpleGUI as sg
layout = [[sg.Text('1'), sg.Input(key='input1', do_not_clear=True),
sg.ReadFormButton('Button Set 1', key='Button Set 1'), sg.ReadFormButton('Button Read 1', key='Button Read 1')],
[sg.Text('2'), sg.Input(key='input2', do_not_clear=True),
sg.ReadFormButton('Button Set 2', key='Button Set 2'), sg.ReadFormButton('Button Read 2', key='Button Read 2')],
[sg.Text('3'), sg.Input(key='input3', do_not_clear=True),
sg.ReadFormButton('Button Set 3', key='Button Set 3'), sg.ReadFormButton('Button Read 3', key='Button Read 3')]]
form = sg.FlexForm('Example from Reddit', default_element_size=(10,1), grab_anywhere=False)
form.Layout(layout)
while True:
button, values = form.Read()
if button is None:
break
if button == 'Button Set 1':
form.FindElement('input1').Update('Entry 1')
elif button == 'Button Set 2':
form.FindElement('input2').Update('Entry 2')
elif button == 'Button Set 3':
form.FindElement('input3').Update('Entry 3')
elif button == 'Button Read 1':
print('input 1 =', values['input1'])
elif button == 'Button Read 2':
print('input 2 =',values['input2'])
elif button == 'Button Read 3':
print('input 3 =',values['input3'])
@MikeTheWatchGuy
Copy link
Author

reddit button problem

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