Asynchronous data loader¶
This is the Asynchronous Loader. You can use it to load an image and use it, even if data are not yet available. You must specify a default loading image for using a such loader:
from kivy import *
image = Loader.image('mysprite.png')
You can also load image from url:
image = Loader.image('http://mysite.com/test.png')
If you want to change the default loading image, you can do:
Loader.loading_image = Image('another_loading.png')
- class kivy.loader.LoaderBase¶
Bases: object
Common base for Loader and specific implementation. By default, Loader will be the best available loader implementation.
The _update() function is called every 1 / 25.s or each frame if we have less than 25 FPS.
- error_image¶
Image used for error (readonly)
- image(filename, load_callback=None, post_callback=None, **kwargs)¶
Load a image using loader. A Proxy image is returned with a loading image.
- ::
- img = Loader.image(filename) # img will be a ProxyImage. # You’ll use it the same as an Image class. # Later, when the image is really loaded, # the loader will change the img.image property # to the new loaded image
- loading_image¶
Image used for loading (readonly)
- run(*largs)¶
Main loop for the loader.
- start()¶
Start the loader thread/process
- stop()¶
Stop the loader thread/process
- class kivy.loader.ProxyImage(arg, **kwargs)¶
Bases: kivy.core.image.Image
Image returned by the Loader.image() function.
Properties : - loaded: bool, default to False
It can be True if the image is already cached
Events : - on_load
Fired when the image is loaded and changed