My KivyMD app from an SQLite database displays a binary blob image for which I created a dialog content class with MDBoxLayout as parent. The database has two images for a particular index, a 300x310px output.jpg file, the other a 320x400px picture.jpg file.
When I changed the image to picture.jpg the image pops up but when I close it, scroll to another index and open the popup, the image doesn’t change and it shows the last one that opened. If I close it and wait a minute and open it again, the right image shows.
<Content>
orientation: "vertical"
spacting: "2sp"
Image:
id: image
source: root.photo_name
class Content(MDBoxLayout):
photo_name = StringProperty()
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.photo_name = "picture.jpg"
class MainApp(MDApp, RecycleView):
def __init__(self, **kwargs):
super().__init__(**kwargs)
##### OTHER CODE ########
### Popup function ###
@staticmethod
def view_popup():
popup = Popup(title="FULL PHOTOGRAPH", title_align="center", content=Content(),
size_hint=(.85, .8))
popup.open()
How can changing the image file with the same code bring different results? Can the pixel size cause a delay in the class changing its instance? I tried MDDialog instead of the popup using type="custom"
and content_cls=Content()
. Still same result. I changed the source in the Content
class from root.photo_name
to app.photo_name
defined in MainApp
class as photo_name = StringProperty("picture.jpg")
. Same result.
0