Before I post here I did some research, but still, I can't fix the problem. Are the entry fields both 0? How can I change the one of the values of the entry so the app can start or there is another way. Thank you!
from tkinter import * root = Tk() root.title('BMI Calculator') root.geometry('180x200+800+400') def bmi(): get_height = ent_height.get() height = int(get_height) get_mass = ent_weight.get() mass = int(get_mass) h = (height * height)/1000 rez = (mass / h) print(rez) if rez < 18.5: result_lbl["text"] = rez print("You are Underweight") elif rez >= 18.5 and rez < 24.9: print("You have Normal Weight") elif rez >= 25 and rez <=29.9: print("You are Overweight") elif rez > 30: print("You are Obese!!!") # Create Frame frame = Frame(height = 550) frame.pack(fill=X) # Create Label and Entry for Height lbl_height = Label(frame, text = 'What is your height(Ex.180cm) ?') lbl_height.grid(row= 0, column = 0) ent_height = IntVar() ent_height = Entry(frame, width=30, textvariable=ent_height) ent_height.grid(row=1, column = 0) # Create Label and Entry for Weight lbl_weight = Label(frame, text='What is your weight(kg)?') lbl_weight.grid(row= 2, column = 0) ent_weight = IntVar(value=1) ent_weight = Entry(frame, width = 30, textvariable=ent_weight) ent_weight.grid(row = 3, column = 0) # Button to calculate everything btnCalc = Button(frame, text = 'Calculate', command = bmi()) btnCalc.grid(row = 5, column = 0) result_lbl = Label(frame, Variable=bmi()) root.mainloop()