首页 > 解决方案 > 此代码显示错误:-- AttributeError: 'NoneType' object has no attribute 'get'

问题描述

''' '这显示错误' '请帮我解决这个问题'

from tkinter import *
root=Tk()


def loginc():
    print(e1.get()) #getting value of entry


l=Label(root)
f=Frame(l,pady="25",padx="25")
lb1=Label(f,text="Enter ID: ",font="lucida 10 bold").grid(column=0,row=2,pady="4")

e1=Entry(f,width="28").grid(column=1,row=2)

lb2=Label(f,text="Enter Password: ",font="lucida 10 bold").grid(column=0,row=3,pady="4")
e2=Entry(f,width="28").grid(column=1,row=3)

btn=Button(f,text="login",bg="green",fg="white",width="10",font="lucida 10 bold",command=loginc)
btn.grid(columnspan=3,row=5,pady="10")
f.grid(column=0,row=6)
l.grid(column=0,row=7)

root.mainloop()

我怎么解决这个问题 '''

标签: tkinterattributeerrortkinter-entry

解决方案


推荐阅读