Skip to content Skip to sidebar Skip to footer

Pyinstaller Adding Splash Screen Or Visual Feedback During File Extraction

I create a single file python application with Pyinstaller using --onefile parameters. Everything work as expected but the startup time is around 10 seconds on my machine. The prob

Solution 1:

I have been battling with this problem myself. Unfortunately, there is no feasible solution to the problem other than using the ugly console (completely agree there).

The problem stems from the fact that until PyInstaller unpacks all the files into a temp dir, no scripts will be run. From my research, there is no way to alter this functionality using currently available options within PyInstaller. It would be nice if the community behind PyInstaller would make this a standard feature of the module, but until then we may have to explore other installer options.

Happy programming!

Solution 2:

There is a beta version of the splash screen!

So just use your normal pyinstaller command in cmd and add:

--splash splashfile.png

Solution 3:

One simple solution might be to display the console window after launching the application, which will output the status of the PyInstaller Bootloader while it is being opened.

To display the console, use the --console flag (or edit the .spec file to contain console = True) when bundling your application. These options are documented in the PyInstaller doc file.

Solution 4:

adding --splash splashfile.png gave me high pink color shades on splash screen, so I used JPG image with some colored background and it worked very well.

another update we need to close splash, within our project code in any suitable place feasible for us, else splash screen remains on top of UI until application itself is closed.

try:
            import pyi_splash
            pyi_splash.update_text('UI Loaded ...')
            pyi_splash.close()
        except:
            pass

and put this splash screen close code with in try block as it is needed only for package execution, and can just pass on exception and proceed at the time of development runs.

Update:

More elegant way to close the splash screen

if'_PYIBoot_SPLASH'in os.environ and importlib.util.find_spec("pyi_splash"):
    import pyi_splash
    pyi_splash.update_text('UI Loaded ...')
    pyi_splash.close()
    log.info('Splash screen closed.')

reason for discarding try/except because, if you generate console exe then try/except will unnecessarily generates warnings, so to completely avoid warnings also, this can be a good check..

Solution 5:

There is a pull request got pyinstaller... Actually, it is already merged into master. It adds this functionality: https://github.com/pyinstaller/pyinstaller/pull/4887

At the moment you will need to build the pyinstaller to have this, but it is feasible. I managed to do this for my project without any deep knowledge in c/c++ etc.

Post a Comment for "Pyinstaller Adding Splash Screen Or Visual Feedback During File Extraction"