from tkinter import *
root = Tk()
root.title("登录")
root['width']= 200;root['height']=80
Label(root,text='用户名',width=6).place(x=1,y=1)
Entry(root,width=20).place(x=45,y=1)
Label(root,tex='密码',width=6).place(x=1,y=20)
Entry(root,width=20,show'*').place(x=45,y=20)
Button(root,tex='登录',width=8).place(x=40,y=40)
Button(root,tex='取消',width=8).place(x=110,y=40)
root.mainloop()
tex 之后的少了t
t
='密码',width=6).place(x=1,y=20)show后少了=
=
'*').place(x=45,y=20)t
='登录',width=8).place(x=40,y=40)t
='取消',width=8).place(x=110,y=40)你题目的解答代码如下:
from tkinter import *
root = Tk()
root.title("登录")
root['width']= 200;root['height']=80
Label(root,text='用户名',width=6).place(x=1,y=1)
Entry(root,width=20).place(x=45,y=1)
Label(root,text='密码',width=6).place(x=1,y=20) #tex 之后的少了t
Entry(root,width=20,show='*').place(x=45,y=20) #show后少了=
Button(root,text='登录',width=8).place(x=40,y=40) #tex 之后的少了t
Button(root,text='取消',width=8).place(x=110,y=40) #tex 之后的少了t
root.mainloop()
如有帮助,望采纳!谢谢!
语法不对,提示的地方。
Entry(root,width=20,show'*').place(x=45,y=20)
改为
Entry(root,width=20,show='*').place(x=45,y=20)