-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcentripetal_force_homework.py
More file actions
26 lines (20 loc) · 1.02 KB
/
centripetal_force_homework.py
File metadata and controls
26 lines (20 loc) · 1.02 KB
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
# https://pypi.org/project/PySimpleGUI/2.7.0/#:~:text=A%20Text%20Element%20with%20a,is%20(45%2C1)%20.
import PySimpleGUI as sg
sg.change_look_and_feel('DarkAmber')
layout = [[sg.Text("Enter mass in kilograms"), sg.Input(key='-MASS-', do_not_clear=True, size=(5, 1))],
[sg.Text("Enter velocity in kilometers per hour"), sg.Input(key='-VELOCITY-', do_not_clear=True, size=(5, 1))],
[sg.Text("Enter radius in meters"), sg.Input(key='-RADIUS-', do_not_clear=True, size=(5, 1))],
[sg.Text(size=(10, 1), justification='right', key='-OUT-CALCULATION-'),
sg.Text(' Newtons')],
[sg.Button('Calculate', bind_return_key=True), sg.Button('Quit')]
]
window = sg.Window('Calculating Centripetal Force', layout)
while True:
event, values = window.read()
if event in (None, 'Quit'):
break
mass = float(values['-MASS-'])
velocity = float(values['-VELOCITY-'])
radius = float(values['-RADIUS-'])
window['-OUT-CALCULATION-'].Update((mass*(velocity**2))/radius)
window.close()