Completely new set of materials for GUI class! Thanks Tony!!
This commit is contained in:
parent
ee0765c345
commit
8f7356f425
53 changed files with 1909 additions and 903 deletions
|
@ -15,8 +15,8 @@ sg.SetOptions (background_color = 'LightBlue',
|
|||
#name inputs (key) uses dictionary- easy to see updating of results
|
||||
#value[input] first input value te c...
|
||||
layout = [ [sg.Text('Enter a Temperature in Celcius')],
|
||||
[sg.Text('Celcius', size =(8,1)), sg.InputText(size = (15,1),key = 'input')],
|
||||
[sg.Text('Result', size =(8,1)), sg.InputText(size = (15,1),key = 'result')],
|
||||
[sg.Text('Celcius', size =(8,1)), sg.InputText(size = (15,1),key = '_input_')],
|
||||
[sg.Text('Result', size =(8,1)), sg.InputText(size = (15,1),key = '_result_')],
|
||||
[sg.ReadButton('Submit', bind_return_key = True)]]
|
||||
|
||||
window = sg.FlexForm('Temp Converter').Layout(layout)
|
||||
|
@ -26,10 +26,11 @@ while True:
|
|||
if button is not None:
|
||||
#catch program errors for text or blank entry:
|
||||
try:
|
||||
fahrenheit = round(9/5*float(value['input']) +32, 1)
|
||||
window.FindElement('result').Update(fahrenheit) #put result in text box
|
||||
fahrenheit = round(9/5*float(value['_input_']) +32, 1)
|
||||
#put result in text box
|
||||
window.FindElement('_result_').Update(fahrenheit)
|
||||
except ValueError:
|
||||
sg.Popup('Error','Please try again') #display error
|
||||
sg.Popup('Error','Please try again')
|
||||
|
||||
else:
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue