【发布时间】:2021-10-29 20:23:55
【问题描述】:
我有一个图像 (400x400),我希望它作为启动图像(在主程序/代码启动之前)位于我的屏幕中心 (1920x1080)。我的问题是我的启动图像周围出现黑屏/窗口。我的代码:
import tkinter as tk
root = tk.Tk()
root.overrideredirect(True)
width = root.winfo_screenwidth()
height= root.winfo_screenheight()
root.geometry('%dx%d+%d+%d' % (width*0.8, height*0.8, width*0.1, height*0.1))
image_file="test.gif"
image = tk.PhotoImage(file=image_file)
canvas = tk.Canvas(root, height=height*0.8, width=width*0.8, bg='black')
canvas.create_image(width*0.8/2, height*0.8/2, image=image)
canvas.pack()
root.after(5000, root.destroy)
root.mainloop()
这是我的初始图片
谢谢各位!
【问题讨论】:
标签: python tkinter splash-screen