-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy path1b PSG (Format).py
31 lines (27 loc) · 969 Bytes
/
1b PSG (Format).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#PySimple examples (v 3.8)
#Tony Crewe
#Oct 2018 MacOs
import FreeSimpleGUI as sg
#Set formatting options for all elements rather than individually.
#MacOs - colour background issue buttons - make text LightBlue
sg.SetOptions (background_color = 'LightBlue',
element_background_color = 'LightBlue',
text_element_background_color = 'LightBlue',
font = ('Arial', 10, 'bold'),
text_color = 'Blue',
input_text_color ='Blue',
button_color = ('Blue', 'White')
)
#adjust widths
layout = [
[sg.Text('Celcius', size =(12,1)), sg.InputText(size = (8,1))],
[sg.Submit()]
]
window = sg.Window('Converter').Layout(layout)
button, value = window.Read()
if button is None:
#windows was closed without button being pressed
exit(0)
fahrenheit = round(9/5*float(value[0]) +32, 1)
result = 'Temperature in Fahrenheit is: ' + str(fahrenheit)
sg.Popup('Result',result)