Answer the question
In order to leave comments, you need to log in
Qivy Python - how to remove photo caching on reload?
The image foto.jpg is placed in the folder, then it is loaded by pressing a button. Then the image is overwritten with a new one, but when the button is pressed, the old photo is loaded. How can this caching be bypassed?
#!/usr/bin/kivy
import kivy
kivy.require('1.0.6')
from os.path import join, dirname
from kivy.app import App
from kivy.uix.scatter import Scatter
from kivy.uix.pagelayout import PageLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.button import Button
from kivy.properties import StringProperty
class Foto(Scatter):
source = StringProperty(None)
class Page2(RelativeLayout):
pass
class Page3(RelativeLayout):
pass
class ButGetFoto(Button):
pass
class PicturesApp(App):
def build(self):
# the root is created in pictures.kv
root = self.root
# листатель страниц
page_layout = PageLayout()
root.add_widget(page_layout)
# страница с фото
page3 = Page3()
page_layout.add_widget(page3)
# и кнопка на ней для получения фото
but_getfoto = ButGetFoto()
but_getfoto.bind(on_release=self.get_foto)
page3.add_widget(but_getfoto)
#следущая страница
page2 = Page2()
page_layout.add_widget(page2)
def get_foto(self, page):
tempfoto = Foto(source=join(curdir, 'foto.jpg'))
page.add_widget(tempfoto)
def on_pause(self):
return True
curdir = dirname(__file__)
if __name__ == '__main__':
PicturesApp().run()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question