思路:…模仿的,以后再加上去
from tkinter import *
from tkinter import messagebox as msgbox
root = Tk()
root.minsize(300, 200)
root.title("登陆窗口")
def login():
if s1.get() == "admin" and s2.get() == "123456":
msgbox.showinfo("恭喜", " 登录成功")
else:
msgbox.showerror("警告", "用户名或密码错误")
s1.set("")
s2.set("")
def re():
s1.set("")
s2.set("")
Label(root, text="输入用户名:").place(x=50, y=40)
Label(root, text=" 输入密码:").place(x=54, y=70)
s1 = StringVar()
s2 = StringVar()
Entry(root, textvariable=s1, width=14).place(x=120, y=40)
Entry(root, textvariable=s2, width=14, show="*").place(x=120, y=70)
Button1 = Button(root, text="登录", width=5, command=login).place(x=80, y=120)
Button2 = Button(root, text="重填", width=5,command=re).place(x=140, y=120)
mainloop()