Alright.. I have the basic interface of the Body Mass Index worked out. However, I dont know how to get the feet,inches, and weight to be be multiplied:
Here is my code for the BMI Calculator:
So I guess I now prompt my question.. How can I get an output box that (using the calculation that I put above) "prints" the answer..
Code:
(w / (h * 12 + x) * (h * 12 + x)) * 703)
Code:
from graphics import *
from math import *
def main():
win = GraphWin("BMI Calculator", 800, 600)
win.setCoords(-2.0, -2.0, 11, 11.5)
Text(Point(5,5), "Feet:").draw(win)
Text(Point(5,3), "Inches:").draw(win)
Text(Point(5,1), "Weight:").draw(win)
h = Entry(Point(7,5), 5)
h.setText("0")
h.draw(win)
x = Entry(Point(7,3), 5)
x.setText("0")
x.draw(win)
w = Entry(Point(7,1), 5)
w.setText("0")
w.draw(win)
# Create Function Box
Text(Point(3, 0), "BMI").draw(win)
stng = Entry(Point(4,0), 7)
stng.setText("0")
stng.draw(win)
output = Entry(Point(4,1), "" )
output.draw(win)
button = Text(Point(1.5,2.0), "Convert")
button.draw(win)
Rectangle(Point(1,1.5), Point(2,2.5)).draw(win)
## wait for a mouse click
win.getMouse()
## convert input
h = float(eval(h.getText()))
x = float(eval(x.getText()))
w = float(eval(w.getText()))
## display output and change button
BMI
## wait for click and then quit
win.getMouse()
win.close()
main()