Consider this simple example:
# coding: utf-8
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.lang import Builder
Builder.load_string('''
<Widget1>:
id:wi
btn:btn
BoxLayout:
orientation:'vertical'
btn:btn
im:im
pos: self.parent.pos
size: self.parent.size
AsyncImage:
id:im
source : 'http://lorempixel.com/400/200/'
size_hint_x : 1
size_hint_y: 1
no_cache:False
Button:
id :btn
text:'Click me !'
size_hint_x : 1
size_hint_y: None
height:50
on_release: wi.click()
''')
class Widget1(Widget):
def __init__(self):
super(Widget1, self).__init__()
def click(self):
# HERE IS THE PROBLEM : ......
self.ids.im._coreimage.remove_from_cache()
self.ids.im._coreimage.source = 'http://lorempixel.com/400/200/'
class WindowApp(App):
def build(self):
return Widget1()
if __name__ == '__main__':
WindowApp().run()
The page '
http://lorempixel.com/400/200/' returns me another picture each time I'm refreshing the page in a browser.
I'm trying to mimic the same thing in Kivy BUT without using no_cache:True in the kv.
The "remove_from_cache()" does not work in this case, but I'm probably doing something wrong.The picture is updating after some period. corresponding to kivy's setup, but this is not what I want.
The situation is I'm retrieving 100's of covers with the REST API from my MediaCenter software and replacing- sometimes- some of them retrived from the Web.
I do not want to load all the covers each time when I'm browsing in my Kivy app., but I would be able to "reload/reset" IMMEDIATELY the ones who have changed but still at the same address.
Of course, I've tried the reload() function also, but no luck.
Thanks