写一个登陆的界面,账号密码对了就会出现一个标签,但是e2['show']='*' ,这句话报错,错误的提示是TypeError: 'NoneType' object does not support item assignment
贴出代码如下
-*- coding:utf-8 -*-
from Tkinter import *
def reg():
s1=e1.get()
s2=e2.get()
t1=len(s1)
t2=len(s2)
if s1=="1111" and s2=="2222":
c["text"]="登陆成功"
else:
c["text"]="登陆失败"
e1.delete(0,t1)
e2.delete(0,t2)
root= Tk()
root.wm_title("登陆界面")
l=Label(root,text="用户名: ")
l.grid(row=0,column=0,sticky=W)
e1=Entry(root)
e1.grid(row=0,column=1,sticky=E)
l2=Label(root,text="密码: ").grid(row=1,column=0,sticky=W)
e2=Entry(root).grid(row=1,column=1,sticky=E)
e2["show"] = '*'
b=Button(root,text="登陆",command=reg).grid(row=2,column=1,sticky=E)
c=Label(root,text=" ")
c.grid(row=3)
root.mainloop()