Image not found error when starting a simple kivy app

Question:

I recently started using kivy and as I gradually learned the language, I wanted to use images.
I then tried the following program:

from kivy.app import App
from kivy.uix.image import Image

class ImageTestApp(App):
    def builder(self):
        image_app = Image(source='on.png')
        return image_app

if __name__ == '__main__':
    ImageTestApp().run()

The source image on.png is in the same directory as the file containing the code.

When I run this program, I get the following error :

[ERROR  ] [Image       ] Not found <on.png>

I tried to put the whole path but I still get the same error.

I can’t understand why the image is not found, can you help me?

Asked By: Pascal Seckinger

||

Answers:

Use the build function, it Initializes the application.

from kivy.app import App
from kivy.uix.image import Image


class ImageTestApp(App):
    def build(self):
        image_app = Image(source='on.png')
        return image_app


if __name__ == '__main__':
    ImageTestApp().run()
Answered By: Neizvestnyj

It is so simple just like
In kivy file
Image: (enter)
(One tab) source: Images(enter two slash instead one)picname.png

With two slash this problem will solve

Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.