Created
October 13, 2018 21:30
-
-
Save MikeTheWatchGuy/6d64f9f9b8ef7ae805d68c942850b19f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| layout = [[sg.Text('Add 2 Numbers', font='Helvetica 15')], | |
| [sg.InputText(size=(8,1) ,key='in1'), sg.Text(' + '), sg.Input(size=(8,1), key='in2'),sg.Text('',key='answer')], | |
| [sg.Text('')], | |
| [sg.ReadButton('Add')]] | |
| window = sg.Window('Add 2 numbers').Layout(layout) | |
| # event loop | |
| while True: | |
| button, values = window.Read() | |
| if button is None: | |
| break | |
| num1 = int(values['in1']) | |
| num2 = int(values['in2']) | |
| answer = num1+num2 | |
| window.FindElement('answer').Update(answer) | |
MikeTheWatchGuy
commented
Oct 13, 2018
Author

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