Pergunta

I have an an image (kivy.uix.image.Image) instantiated with a source, but I change the source file's data. How can I refresh the image to reflect the new data?

Foi útil?

Solução

Hard case, since the filename is used as key for caching. You can clear all the cache, before changing the source:

from kivy.cache import Cache
Cache.remove('kv.image')
Cache.remove('kv.texture')
# then change the source of the image

It should be ok, but not efficient.

As qua-non said:

Also if you can use the development branch or wait for the 1.3 release. You can use the following functions to achieve just that ::

For the Image widget Image.reload()

For the Core Image Image.remove_from_cache()

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top