0
Hello, I’m doing some testing with the framework Kivy and this error is being presented to me:
AttributeError: 'NoneType' object has no attribute 'text'
Well, follow the code Python:
class Window(BoxLayout):
text = StringProperty('Nome')
screen_manager = ScreenManager()
def __init__(self, **kwargs):
super(Window, self).__init__(**kwargs)
class Main(App):
def build(self):
return Window()
if __name__ == '__main__':
Main().run()
And the code in KV language:
<Window>:
Screen:
BoxLayout:
Button:
text: app.root.text
The object
app.root
apparently not defined.– Woss
I also realized that, and I thought it was strange the obese being
None
, but according to the documentation (https://kivy.org/docs/api-kivy.app.html?highlight=app%20root#kivy.app.App.root), the object root is set automatically by the method build (in this case).– Nayron Morais