Kivy returns "AttributeError: 'NoneType' object has no attribute 'bind'" when accessing ListProperty

Viewed 2317

I'm trying to create a screen that displays an image file whose path is stored in a ListProperty. I understand that the error message indicates that Kivy is trying to access the value before the ListProperty is created, but I don't know how to fix this.

Here's a snippet from my main.py script where the property is initialized to an empty list containing a single empty string and the build method is called:

presentation = Builder.load_file("main.kv")

class MainApp(App):
    image_list = ListProperty([''])

    def build(self):
        return presentation

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

And here is a section of main.kv where the property is used:

<Screen1>:
    name: 'screen1'
    BoxLayout:
        orientation: 'horizontal'
        Picture:
            source: app.image_string.pop()

The exception thrown is as follows:

 ...
 BuilderException: Parser: File "main.kv", line 71:
 ...
      69:        orientation: 'horizontal'
      70:        Picture:
 >>   71:            source: app.image_string.pop()
      72:

Any guidance on how to fix this would be greatly appreciated. Thanks!

EDIT Reader FIns pointed out that I was calling image_string instead of image_list, but even after making the correction, I get the same error:

BoxLayout:
    orientation: 'horizontal'
    Picture:
        source: app.image_list.pop()
 BuilderException: Parser: File "main.kv", line 71:

And ...

 BuilderException: Parser: File "main.kv", line 71:
 ...
      69:        orientation: 'horizontal'
      70:        Picture:
 >>   71:            source: app.image_list.pop()
1 Answers
Related