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?
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()