From 57618ef263bfb5360c111f91c08fe75da04966f0 Mon Sep 17 00:00:00 2001 From: pp2fytckq <1425355971@qq.com> Date: Sat, 1 Jun 2024 22:30:44 +0800 Subject: [PATCH] ADD file via upload --- welcome.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 welcome.py diff --git a/welcome.py b/welcome.py new file mode 100644 index 0000000..db95bce --- /dev/null +++ b/welcome.py @@ -0,0 +1,27 @@ +from tkinter import * + +def button_click(): + window.destroy() # 关闭当前窗口 + import main # 导入主界面的代码 + +window = Tk() +window.title("欢迎界面") + +label_welcome = Label(window, text="欢迎帅哥美女来到身体健康数据检测", font=("Arial", 20)) +label_welcome.pack(pady=20) + +button = Button(window, text="点击进入首页", command=button_click) +button.pack(pady=10) +button.place(relx=0.5, rely=0.5, anchor=CENTER) # 将按钮放在窗口中间 + +screen_width = window.winfo_screenwidth() +screen_height = window.winfo_screenheight() + +window_width = int(screen_width / 2) +window_height = int(screen_height / 2) + +x = (screen_width - window_width) // 2 +y = (screen_height - window_height) // 2 +window.geometry("{}x{}+{}+{}".format(window_width, window_height, x, y)) + +window.mainloop() \ No newline at end of file