我应该如何在tkinter中解决此按钮错误?

时间:2019-09-14 18:41:45

标签: python-3.x tkinter data-science

尝试为我的预测系统创建GUI,但无法解决错误

window=Tk()

window.title("Health Predictor")

window.geometry("440x330")

'''All the labels here'''

def output():

    age=int(e2.get())
    sex=int(e3.get())
    cp=int(e4.get())
    chol=int(e4.get())
    fbs=int(e5.get())
    thalach=int(e6.get())
    exang=int(e7.get())
    oldpeak=int(e8.get())
    slope=int(e9.get())
    ca=int(e10.get())
    thal=int(e11.get())
    pred=[age,sex,cp,chol,fbs,thalach,exang,oldpeak,slope,ca,thal]
    result=knn.predict[pred]
    if (result==0):
        messagebox.showinfo('Result','Negative')
    else:
        messagebox.showinfo('Result','Positive')


b1=Button(text='Calculate',command=output)

b1.grid(column=0,row=5)

window.mainloop()

File "", line 20

b1=Button(text='Calculate',command=output)

 ^
SyntaxError: invalid syntax

b1.grid(column=0,row=5)

Traceback (most recent call last):

File "", line 1, in

NameError: name 'b1' is not defined

0 个答案:

没有答案