Guides
Splash Screen
Provides splash screen functionality displayed during application loading.
Basic Usage
1. Splash Screen Setup
Static Image Splash Screen
app = Pyloid(app_name="Pyloid-App")
window = app.create_window("Splash Screen Example")
window.set_static_image_splash_screen(image_path="./assets/loading.png")
Parameters
image_path
: Image file pathclose_on_load
: Auto-close on page load completion (default: True)stay_on_top
: Always display on top (default: True)clickable
: Allow closing by click (default: True)position
: Splash screen position (default: "center")- Supported positions: "center", "top-left", "top-right", "bottom-left", "bottom-right"
GIF Splash Screen
window.set_gif_splash_screen(gif_path="./assets/loading.gif")
Parameters
gif_path
: GIF file pathclose_on_load
: Auto-close on page load completion (default: True)stay_on_top
: Always display on top (default: True)clickable
: Allow closing by click (default: True)position
: Splash screen position (default: "center")- Supported positions: "center", "top-left", "top-right", "bottom-left", "bottom-right"
2. Splash Screen Control
Manually Close Splash Screen
window.close_splash_screen()
Timer Control Example
from pyloid.timer import PyloidTimer
# ... assuming window object is already created
def close_splash_and_show_main():
window.close_splash_screen()
window.show_and_focus()
# Create timer manager
timer_manager = PyloidTimer()
# Close splash screen and show main window after 3 seconds
timer_manager.start_single_shot_timer(3000, close_splash_and_show_main)
Usage Scenarios
-
Initial Loading Screen
- Loading resources at application start
- Database connection
- External API initialization
-
Display During Long Operations
- Large file processing
- Network operations
- Complex calculations
Precautions
- Optimize GIF files with appropriate size and quality
- Manual splash screen closure required when
close_on_load=False