Skip to content
Advertisement

Kivy Error when I close the DatePicker (MultiScreen)

I’m trying to learn Kivy. Most stuff works when I just code it separate. But when I combine like MultiScreen with other code I always strugle.

Here I want that after closing the DatePicker to change the Text(id: date_label. Same code worked without the MultiScreen

Error: line 31, in on_cancel self.root.ids.date_label.text = “Cancel” AttributeError: ‘CreateScreen’ object has no attribute ‘root’

JavaScript

KV File

JavaScript

Thank you

Advertisement

Answer

The error is telling you that 'CreateScreen' object has no attribute 'root'. You are trying to refer to root in the line:

JavaScript

In that line, self is the instance of CreateScreen, so self.root is trying to access a root attribute of self (CreateScreen). If you are trying to access the ids of CreateScreen, then just use:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement