How to create a Splash Screen using Tkinter?


Let us suppose that we want to create a splash screen using tkinter. To create a splash screen, we will follow the steps given below −

  • Create a splash screen with some labels in it.

  • Make the splash screen borderless using the overrideredirect method.

  • Create a function for the main window which will appear for a time just after the splash screen.

  • Now using the after method, we can define the time for which the main window will appear.


#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

#Remove border of the splash Window


#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():
   win= Tk()
   win.title("Main Window")
   win_label= Label(win, text= "Main Window", font= ('Helvetica', 25), fg= "red").pack(pady=20)

#Splash Window Timer

splash_win.after(5000, mainWin)


Running the above code will generate the output and will show the splash screen and after some time, the main window.


Published on 04-Mar-2021 14:03:40