Loading

酷炫Python窗体程序Splash启动欢迎页

准备启动素材

png图片

创建代码文件

sflash.pyw

#!/usr/bin/env python3
# -*- coding:utf-8 -*-


import tkinter as tk

splash = tk.Tk()

x = int(splash.winfo_screenwidth() / 2.5 - splash.winfo_reqwidth() / 2.5)
y = int(splash.winfo_screenheight() / 10 - splash.winfo_reqheight() / 10)
print(x,y)

canvas = tk.Canvas(splash,width=405,height=903,highlightthickness=0)
img = tk.PhotoImage(file="show.png")
canvas.create_image(0,0,anchor=tk.NW,image=img)
canvas.pack()

splash.title('欢迎页')
splash.geometry(f"405x903+{x}+{y}")
splash.overrideredirect(True)

splash.after(5000,lambda:splash.destroy())

tk.mainloop()

查看效果

posted @ 2021-09-04 16:31  Binzichen  阅读(342)  评论(0编辑  收藏  举报