SHARE
TWEET

Hiba

a guest Feb 14th, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import tkinter
  2. window = tkinter.Tk()
  3. e = tkinter.Entry(window)
  4. ew = e.get()
  5. e.grid(row=0, column=1)
  6.  
  7. e1 = tkinter.Entry(window)
  8. eh = e1.get()
  9. e1.grid(row=0, column=3)
  10.  
  11. label = tkinter.Label(window, text="Your Height:")
  12. label.grid(row=0, column=0)
  13.  
  14. label1 = tkinter.Label(window, text="Your Width:")
  15. label1.grid(row=0, column=2)
  16.  
  17. class Ember:
  18.     def __init__(self, magassag, tomeg):
  19.         self.magassag = magassag
  20.         self.tomeg = tomeg
  21. ember = Ember(int(eh), int(ew))
  22. def bmi_szamolas():
  23.     bmi_eredmeny = ember.tomeg / (ember.magassag * 2)
  24.     bmi_eredmeny_vegleges = round(bmi_eredmeny, 2)
  25.     bmi_eredmeny_vegleges1 = int(bmi_eredmeny_vegleges * 100)
  26.     print(bmi_eredmeny_vegleges1)
  27.     if bmi_eredmeny_vegleges1 > 25:
  28.         print("You are overweight!")
  29.     if bmi_eredmeny_vegleges1 < 25:
  30.         print("You aren't overweight!")
  31.  
  32. button = tkinter.Button(window, text="Calculate your bmi!", command=bmi_szamolas)
  33. button.grid(row=0, column=4)
  34.  
  35. window.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top