python tkinter 中的 Gui 编程

Gui programming in python tkinter

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()

Enter your weight in kg: 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 编程,但我不知道我遇到了错误。

嗯,首先,你所做的一切都是错误的。在尝试之前,您应该阅读一些文档。在 tk() 之后放置 print 和 input 语句不是正确的方法。

Here's some useful information.