用户:
5735733查看:0 回复:2 评论:0 创建时间:2022-12-24T21:30:10
【作品展示】

【作品介绍】
打开保存文件模板
【作品源代码】
from tkinter import filedialog
from tkinter import *
import tkinter
import tkinter.messagebox as ms
t1 = tkinter.Tk()
t1.geometry("400x400")
def dl():
c1=int(ey1.get())
c2=int(ey2.get())
if c1==int(123):
if c2==int(456):
ms.showinfo("温馨提示", "登录成功")
t1.destroy()
t2 = tkinter.Tk()
t2.geometry("400x400")
def openfile():
filedialog.askopenfile()
def closefile():
filedialog.asksaveasfilename()
btn3 = Button(text="打开文件", command=openfile)
btn3.place(x=10, y=10)
btn4 = Button(text="保存文件", command=closefile)
btn4.place(x=10, y=50)
t2.mainloop()
else:
ms.showinfo("温馨提示", "登录失败")
else:
ms.showinfo("温馨提示", "登录失败")
def cz():
ey1.delete(0, "end")
ey2.delete(0, "end")
lz=Label(text="账号:")
lz.place(x=10,y=10)
ey1=Entry()
ey1.place(x=50,y=10)
lm=Label(text="密码:")
lm.place(x=10, y=35)
ey2= Entry()
ey2.place(x=50, y=35)
b1=Button(text="登录",command=dl)
b1.place(x=60,y=60)
b3 = Button(text="重置",command=cz)
b3.place(x=160, y=60)
t1.mainloop()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn