简体   繁体   中英

Loading Images and music Leads to not responding state for few seconds - kivy python

I am writing a code which loads some images and music files for their usage in the code .

Problem is that it goes to not responding state for few seconds when i run program for the first time in windows , I know it should take some time to load images and music however i want to do that without going to not responding state but at a time when i can show a screen named loading and on background all stuff gets loaded and once stuff is loaded program should go further .

Any ideas ?

You should be able to make the splash screen visible, although I am new to kivy so I don't know how. In some SDK you can control when the screen disappears, you could make it disappear after your media are loaded. But sometimes this will mean too long a wait for UI to appear, in that case you are better off doing as @inclement suggests in Remove or replace the kivy splash screen on startup :

make sure your build method doesn't do much, and try to construct as much state as possible only after that.

You would typically load the media in a separate thread that you start from the GUI build method, and you have your thread signal load complete via a callback where you update GUI accordingly. I don't know yet if that is how one is meant to do it in kivy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM