-1
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 编程,但我遇到了错误。

4

1 回答 1

2

好吧,对于初学者来说,你所做的一切都是错误的。在尝试之前,您应该去阅读一些文档。在 tk() 之后放置打印和输入语句不是要走的路。

这里有一些有用的信息。

于 2021-10-08T13:12:05.157 回答