How to create a Splash Screen using Tkinter?

A splash screen is a temporary window that appears when an application starts, typically showing a logo, loading message, or application name. In Tkinter, you can create a professional splash screen that displays briefly before the main application window opens.

Steps to Create a Splash Screen

To create a splash screen using Tkinter, follow these steps:

  • Create a splash window with labels and styling

  • Make the splash screen borderless using overrideredirect()

  • Create a function for the main window

  • Use the after() method to control display timing

Example

Here's a complete example showing how to create a splash screen ?

# 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)

# Center the splash screen on the screen
splash_win.update_idletasks()
width = splash_win.winfo_width()
height = splash_win.winfo_height()
x = (splash_win.winfo_screenwidth() // 2) - (width // 2)
y = (splash_win.winfo_screenheight() // 2) - (height // 2)
splash_win.geometry(f"{width}x{height}+{x}+{y}")

# Define the label of the window
splash_label = Label(splash_win, text="Hello World!", fg="green",
                    font=('Times New Roman', 40))
splash_label.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")
    win_label.pack(pady=20)

# Splash Window Timer - show for 5 seconds
splash_win.after(5000, mainWin)

mainloop()

Running the above code will display the splash screen for 5 seconds, then automatically open the main window.

Key Features Explained

Method Purpose Description
overrideredirect(True) Remove borders Creates a borderless window
after(5000, function) Timer control Calls function after 5000ms (5 seconds)
destroy() Close window Removes the splash screen from memory

Enhanced Splash Screen

Here's an improved version with better styling and positioning ?

from tkinter import *

# Create splash window
splash_win = Tk()
splash_win.title("Loading...")
splash_win.geometry("400x300")
splash_win.overrideredirect(True)
splash_win.configure(bg='#2c3e50')

# Center the window
splash_win.update_idletasks()
x = (splash_win.winfo_screenwidth() // 2) - 200
y = (splash_win.winfo_screenheight() // 2) - 150
splash_win.geometry(f"400x300+{x}+{y}")

# Add title label
title_label = Label(splash_win, text="MyApp", 
                   fg="white", bg="#2c3e50",
                   font=('Arial', 36, 'bold'))
title_label.pack(pady=50)

# Add loading label
loading_label = Label(splash_win, text="Loading...", 
                     fg="#ecf0f1", bg="#2c3e50",
                     font=('Arial', 14))
loading_label.pack(pady=20)

def open_main_window():
    splash_win.destroy()
    
    # Create main application window
    main_win = Tk()
    main_win.title("Main Application")
    main_win.geometry("600x400")
    
    welcome_label = Label(main_win, text="Welcome to MyApp!", 
                         font=('Arial', 24), fg="#2c3e50")
    welcome_label.pack(pady=100)

# Show splash for 3 seconds
splash_win.after(3000, open_main_window)
splash_win.mainloop()

Conclusion

Creating a splash screen in Tkinter involves using overrideredirect(True) for borderless display and after() for timing control. This technique provides a professional application startup experience while the main program loads.

Updated on: 2026-03-25T16:52:16+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements