How to Create a Splash Screen in Python with Tkinter
A splash screen is the temporary window users see while your application is starting up. It displays a logo, progress bar, or loading message, then closes automatically when the main app is ready.
In this tutorial, you will build a complete splash screen in Python using Tkinter — with a centered borderless window, image logo, animated progress bar, and auto-close behavior. All using only Python's built-in libraries.
What is a Splash Screen?
A splash screen is a temporary graphical window shown during application startup. It serves several purposes:
- Branding — displays the app logo and name while loading
- Progress feedback — shows a progress bar so users know the app is starting
- Polished UX — makes the app feel professional instead of appearing frozen
- Time-buying — gives the application time to load resources before showing the main window
Splash screens are common in Android, iOS, and desktop applications — including popular IDEs like IntelliJ IDEA and Visual Studio.
Requirements
- Python 3.x — installed and added to PATH
- Tkinter — comes bundled with Python (no separate installation needed)
- A logo image — for example,
attendance_image_splash.png
Tkinter supports PNG, GIF, PPM, and PGM image formats out of the box. If you need JPG
support, install the Pillow library using pip install Pillow.
Complete Python Code
Save this as splash.py and run it with python splash.py:
from tkinter import *
from tkinter.ttk import Progressbar
import time
class SplashFile(Frame):
def __init__(self, master=None, width=0.8, height=0.6, useFactor=True):
Frame.__init__(self, master)
self.pack(side=TOP, fill=BOTH, expand=NO)
# Get the window dimensions
windowWidth = root.winfo_reqwidth()
windowHeight = root.winfo_reqheight()
# Calculate center position
positionRight = int(root.winfo_screenwidth() / 2 - windowWidth / 2)
positionDown = int(root.winfo_screenheight() / 2 - windowHeight / 2)
# Position the window in the center of the screen
root.geometry("+{}+{}".format(positionRight, positionDown))
# Remove the title bar and window borders
self.master.overrideredirect(True)
self.lift()
if __name__ == '__main__':
root = Tk()
sp = SplashFile(root)
# Load the splash image
photo = PhotoImage(file=r"attendance_image_splash.png")
photoimage = photo.subsample(2, 2)
# Display the image
m = Label(sp, image=photoimage)
m.pack(side=TOP, expand=YES)
# Create the progress bar
progress = Progressbar(root, orient=HORIZONTAL,
length=100, mode='determinate')
progress.pack(side=TOP, fill=X)
# Animate the progress bar from 0 to 100
for i in range(101):
time.sleep(0.05)
progress['value'] = i
progress.update()
if progress['value'] == 100:
print("close window")
root.destroy()
root.mainloop()
Note: Replace attendance_image_splash.png with the path to
your own logo image. If the image is in the same folder as your script, just use the
filename.
Output
The splash screen appears centered on the screen with the logo on top and a progress bar below:
The window stays on top, shows a splash image, animates a progress bar from 0% to 100%, and then closes itself automatically.
How It Works (Step-by-Step)
-
Import required modules —
tkinterfor the GUI,tkinter.ttk.Progressbarfor the progress indicator, andtimefor the loading delay. -
Create a Frame subclass —
SplashFileextendsFrameand packs itself into the root window. -
Center the window — reads the screen dimensions via
winfo_screenwidth()andwinfo_screenheight(), then setsroot.geometry("+X+Y")to position the splash in the middle. -
Remove the title bar —
overrideredirect(True)strips away the OS window frame, making it look like a seamless popup. -
Load the logo —
PhotoImageloads the image, andsubsample(2, 2)halves its size (useful for high-resolution assets). -
Display the logo — a
Labelwidget holds the image and is packed at the top of the frame. -
Create the progress bar — a
Progressbarindeterminatemode spans the width of the window. -
Animate the progress — a
forloop updatesprogress['value']from 0 to 100, sleeping 50 ms between updates, and callsprogress.update()to force the UI to refresh. -
Auto-close — when the progress reaches 100,
root.destroy()closes the splash and control returns to the main application.
Customization Ideas
-
Add a loading message — insert a
Labelwithtext="Loading..."above the progress bar. -
Change the duration — adjust
time.sleep(0.05). Use0.01for a fast splash or0.1for a slower one. -
Change the background color — use
sp.config(bg="#3366ff")to give the splash a custom color. -
Use Pillow for JPG support — install Pillow and use
ImageTk.PhotoImageto load JPG, BMP, and WebP images. -
Chain into the main app — after
root.destroy(), launch your main window in a separate function or subprocess. -
Use a GIF for animation — Tkinter natively supports animated GIFs
via
PhotoImage(file="loading.gif", format="gif -index 0").
Frequently Asked Questions
What is a splash screen in Python?
A splash screen is a temporary window shown while an application is starting up. It displays a logo, progress bar, or loading message to reassure users that the app is launching, then closes automatically when the main application is ready.
How do I create a splash screen using Tkinter?
Create a Tk root window, use a Tkinter Frame subclass to hold your splash
content, call overrideredirect(True) to remove the title bar, use
PhotoImage to load your logo, add a Progressbar for the loading
indicator, and call root.destroy() once the progress completes.
What does overrideredirect(True) do in Tkinter?
overrideredirect(True) removes the window's title bar, borders, and system
controls (minimize/maximize/close). This is essential for splash screens because it makes
the window look like a seamless popup rather than a regular application window.
How do I center a Tkinter window on the screen?
Get the screen width and height via winfo_screenwidth() and
winfo_screenheight(), get the window size via
winfo_reqwidth() and winfo_reqheight(), then calculate
positionRight and positionDown and call
root.geometry("+X+Y").
How do I add a progress bar to a Tkinter splash screen?
Import Progressbar from tkinter.ttk, create it with
orient=HORIZONTAL and mode='determinate', pack it, then loop
through values 0-100 updating progress['value'] and calling
progress.update() to force the UI to refresh.
Conclusion
In this tutorial, you built a complete splash screen in Python using Tkinter — with a centered borderless window, an image logo, a progress bar, and automatic closing. This pattern works for any desktop application where you want to show a polished loading experience.
You can extend this example by adding a loading message, using an animated GIF, or chaining the splash directly into your main application window after it closes.
Related topics: Tkinter Introduction, Python GUI Tutorial, Tkinter Progressbar, Tkinter PhotoImage, Tkinter Event Handling, Python Desktop Application Development