How to detect end of picture download in AsyncImage in Kivy?
Question: i'm writting a simple appliaction like this one:

    
    
    #!/usr/bin/env python2.7
    # -*- coding: utf-8 -*-
    
    from kivy.app import App
    from kivy.uix.boxlayout import BoxLayout
    from kivy.uix.image import AsyncImage
    
    
    class Application(App):
    
        def build(self):
            box_layout = BoxLayout(orientation='vertical')
            img = AsyncImage(
                source='http://pl.python.org/forum/Smileys/default/cheesy.gif')
    
            box_layout.add_widget(img)
            return box_layout
    
        def __on_image_loaded(self):
            print('Very importatn stuff executed afer image has been downloaded by img widget.')
    
    app = Application()
    app.run()
    

How can I detect that AsyncImage widget ended downloading picture from given
URL?

Alternatively I can write downloading thread by myself and use Image widget
but in this case what could I do to load raw bytes from memory to Image widget
to display them as a picture?


Answer: You can use `img._coreimage.bind(on_load=self.on_image_loaded)`:

    
    
    #!/usr/bin/env python2.7
    # -*- coding: utf-8 -*-
    
    from kivy.app import App
    from kivy.uix.boxlayout import BoxLayout
    from kivy.uix.image import AsyncImage
    
    
    class Application(App):
    
        def build(self):
            box_layout = BoxLayout(orientation='vertical')
            img = AsyncImage(source='http://pl.python.org/forum/Smileys/default/cheesy.gif')
            img._coreimage.bind(on_load=self.on_image_loaded)
    
            box_layout.add_widget(img)
            return box_layout
    
        def on_image_loaded(self, *args):
            print('Very importatn stuff executed afer image has been downloaded by img widget.')
    
    app = Application()
    app.run()
    

