【发布时间】:2021-10-08 13:07:26
【问题描述】:
import tkinter as tk
weight = tk(float(input("Enter your weight in kgs : ")))
height = tk(float(input("Enter your height cms : ")))
bmi = weight/ (height/100)**2
if bmi <= 17.5:
tk(print("You are severely underweight:"))
elif bmi <= 18.5:
tk(print("You are underweight:"))
elif bmi <= 25:
tk(print("You have Normal weight"))
elif bmi <= 30:
tk(print("You are overweight"))
elif bmi <= 40:
tk(print("You are obese"))
else:
tk(print("You are severely obese"))
tk(print(bmi))
m.mainloop()
以公斤为单位输入您的体重:85
Traceback (most recent call last):
File "/Users/damanbir singh/Desktop/ffc.py", line 2, in <module>
weight = tk(float(input("Enter your weight in kgs : ")))
TypeError: 'module' object is not callable
我正在尝试在没有任何知识的情况下进行 GUI 编程,但我遇到了一个错误。
【问题讨论】:
-
你不能只输入你希望能工作的代码。您应该从学习 tkinter 教程开始,以便学习基础知识。
标签: python-3.x tkinter graphical-programming