Retrieve image from sqlite3 and display in Kivy image widget - ValueError

后端 未结 2 515
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-25 19:26

REQUIREMENT

I\'m trying to retrieve an image from Database and set this image to kivy image widget, this operation throws a ValueError, unsure of the ca

2条回答
  •  悲哀的现实
    2021-01-25 19:46

    After execution of io.BytesIO(), data is in Bytes. Use Kivy CoreImage and texture to convert data.

    Replace

    self.image.source = data
    

    with:

    self.image.texture = CoreImage(data, ext="png").texture
    

    Image source

    source
    

    Filename / source of your image.

    source is a StringProperty and defaults to None

    Output

提交回复
热议问题