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 problems is that during the file unpacking process of Pyinstaller package there are no visual feedback, so you don't know if the application is starting or even if you really clicked the icon. This problem became worse if the machine is slow (on my test with a very old machine i need almost 20 seconds to see the first login of my application) There is a way to create some splash screen or visual feedback (like a progress bar as on unpackers) during the Pyinstaller bootstrap sequence?
Please note the question is about Pyinstaller unpacking process BEFORE the real application will be executed not by the application itself that already has is own splash screen
thank you
19.01.2018 - UPDATE1 My application is FULL GUI so i prefer to not use the console as "visual feedback" during the unpacking process.
There is a beta version of the splash screen!
So just use your normal pyinstaller
command in cmd and add:
--splash splashfile.png
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.
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..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With