""" Demo Program - Image Element Splash Screen

This program demonstrates how to create a splash screen using the Image element in PySimpleGUI.

The splash screen is displayed for a few seconds before the main window is shown.

Author: PySimpleGUI Team """

import PySimpleGUI as sg

def create_splash_screen(): layout = [[sg.Image('logo.png')]] return sg.Window('Splash Screen', layout, no_titlebar=True, finalize=True)

def create_main_window(): layout = [[sg.Text('Welcome to the Main Window!')]] return sg.Window('Main Window', layout)

def main(): splash_screen = create_splash_screen() main_window = None

# Show the splash screen for a few seconds
for i in range(3):
    event, _ = splash_screen.read(timeout=1000)
    if event == sg.WINDOW_CLOSED:
        break

# Close the splash screen and open the main window
splash_screen.close()
main_window = create_main_window()
while True:
    event, _ = main_window.read()
    if event == sg.WINDOW_CLOSED:
        break
main_window.close()

if name == 'main': main(

DemoProgramsDemo_Image_Elem_Splash_Screenpy

原文地址: https://www.cveoy.top/t/topic/iWP9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录