Skip to main content

A native Windows GDI+ splash screen module with smooth animations and transparency.

Project description

PyPreSplash

A lightning-fast, native Windows splash screen module for Python applications.

Why does this exist?

Python applications (especially those using heavy libraries or frameworks like PyQt/Kivy) take a few seconds to start up. Without a splash screen, users might click your app icon, see nothing happen for 4 seconds, assume it's broken, and click it three more times.

PyPreSplash pops up instantly using the native Windows API. It gives your users immediate visual feedback (a logo and a progress bar) while Python quietly finishes doing the heavy lifting in the background.

Features

  • Zero Heavy Dependencies: Uses native Win32/GDI+ APIs. No need to load Tkinter, PyQt, or Kivy just to show a loading screen.
  • True Transparency: Fully supports PNGs with transparent backgrounds. No ugly black boxes around your logo.
  • Smooth 60FPS Animations: The progress bar smoothly glides to its target using a C++ micro-loop, ensuring the window stays responsive.
  • Minimalist UI: The progress bar draws directly over your image edge-to-edge for a modern look.
  • Dynamic Styling: Change progress bar and text colors on the fly using standard Hex codes (e.g., #0f62fe).
  • Custom Typography: Use any system font (e.g., "Segoe UI", "Consolas") with hardware-accelerated ClearType rendering.

Installation

This project is built using C++17, Pybind11, and scikit-build-core.

Prerequisites:

  • Windows 10 or 11
  • Python 3.8+
  • A C++ Compiler (Visual Studio / MSVC)

Install for Development

To install the module directly into your current Python environment:

pip install .

Build a Distributable Wheel

To compile a .whl file that you can distribute to end-users (so they don't need a C++ compiler installed to use your app):

pip install build
python -m build --wheel

The compiled wheel will be located in the dist/ folder.

Quick Start

Here is a complete example of how to mask a heavy application load.

import time
import pypresplash

def main():
    splash = pypresplash.SplashScreen()

    splash.set_font("Segoe UI", 12) 

    success = splash.show("presplash.png", 0, 600, 600, "contain")
    
    if not success:
        print("Failed to load splash screen.")
        return

    stages = [
        "Initializing core subsystems...",
        "Loading graphics engine...",
        "Mounting file system...",
        "Connecting to services..."
    ]

    for i, stage_msg in enumerate(stages):
        progress = int((i / len(stages)) * 100)

        splash.set_progress(progress, stage_msg, "#0f62fe", "#FFFFFF")
        time.sleep(0.8)

    splash.set_progress(100, "Ready!", "#42be65", "#FFFFFF")
    time.sleep(0.5)

    splash.hide()
    
    print("Main application started.")

if __name__ == "__main__":
    main()

API Reference

SplashScreen()

Initializes the splash screen object and starts the GDI+ subsystem.

.show(image_path, timeout_ms=0, width=0, height=0, scale_mode="stretch") -> bool

Creates and displays the splash screen window.

  • image_path: Path to your .png, .jpg, or .bmp file.
  • timeout_ms: Optional auto-close timer in milliseconds (0 keeps it open indefinitely).
  • **width / height**: Target window dimensions. If 0, it defaults to the exact size of the image file.
  • scale_mode:
  • "stretch" (Default): Forces the image to exactly match the target width/height.
  • "contain": Scales the image to fit entirely inside the width/height while maintaining aspect ratio. Unused space is transparent.
  • "cover": Scales the image to fill the entire width/height, cropping edges if necessary.

.set_progress(value, message="", hex_color="#00A8FF", text_color="#FFFFFF")

Smoothly animates the progress bar to a new value.

  • value: Integer between 0 and 100.
  • message: Status text displayed just above the loading bar.
  • hex_color: Hex string for the loading bar (e.g., "#FF5733").
  • text_color: Hex string for the status text.

.set_font(family, size=14)

Configures the text rendering engine. Must be called before .set_progress.

  • family: Name of an installed system font (e.g., "Segoe UI", "Consolas").
  • size: Font size in points. (Recommended: 10 to 13).

.hide()

Destroys the window and safely releases GDI+ resources.

.is_visible() -> bool

Returns True if the splash screen is currently active and rendered on screen.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypresplash-1.0.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypresplash-1.0.0-cp313-cp313-win_amd64.whl (99.8 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file pypresplash-1.0.0.tar.gz.

File metadata

  • Download URL: pypresplash-1.0.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pypresplash-1.0.0.tar.gz
Algorithm Hash digest
SHA256 46a9602a117123efd152fdf35d11d190974017403a7a5cf1fd8e4acfda96c3ef
MD5 0bf654742612bb54c9eb94c4d4f2d1b4
BLAKE2b-256 3cf08fbc6b8673e93bf84d99128d04863d7f1f18d71a31f7101cad7eedb27957

See more details on using hashes here.

File details

Details for the file pypresplash-1.0.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pypresplash-1.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7e75ba4b233a201196b332062a9707cc4d4b4e216fd32de8c0086177769a7bf3
MD5 01e3fa46c2dea3b0de8a872aed57ea52
BLAKE2b-256 0b00aa3cfeefb5a2530e5a88fa7766cb41ed66f16e10ae9f22f7975c04824516

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page