tkinter를 사용하여 시작 화면을 만들고 싶다고 가정해 봅시다. 스플래시 화면을 만들려면 아래 단계를 따르십시오 -
-
일부 레이블이 포함된 시작 화면을 만듭니다.
-
overrideredirect를 사용하여 스플래시 화면을 테두리 없이 만들기 방법.
-
시작 화면 직후에 잠시 동안 나타날 메인 창에 대한 기능을 만듭니다.
-
이제 이후를 사용합니다. 방법을 사용하여 기본 창이 표시되는 시간을 정의할 수 있습니다.
예시
#Importing the tkinter library
from tkinter import *
#Create an instance of tkinter frame
splash_win= Tk()
#Set the title of the window
splash_win.title("Splash Screen Example")
#Define the size of the window or frame
splash_win.geometry("700x200")
#Remove border of the splash Window
splash_win.overrideredirect(True)
#Define the label of the window
splash_label= Label(splash_win, text= "Hello World!", fg= "green",
font= ('Times New Roman', 40)).pack(pady=20)
def mainWin():
splash_win.destroy()
win= Tk()
win.title("Main Window")
win.geometry("700x200")
win_label= Label(win, text= "Main Window", font= ('Helvetica', 25), fg= "red").pack(pady=20)
#Splash Window Timer
splash_win.after(5000, mainWin)
mainloop() 위의 코드를 실행하면 출력이 생성되고 시작 화면이 표시되고 잠시 후 기본 창이 표시됩니다.
출력

