Binding to property wrapped in class

10 views
Skip to first unread message

Petr Sturc

unread,
Jun 19, 2018, 8:19:43 AM6/19/18
to Kivy users support
Folks,

probably stupid newbie's question  - how to bind, from Kivy language, to a property wrapped in an object ?
What I am trying to do is something like:

Label:
     text: app.myobject.myproperty

, where app is something like

class MyApp(App):
    myobject = MyWrapper()

class MyWrapper:
    myproperty = StringProperty("TEST")


This seems not to work, I mean change of  myobject.myproperty doesn''t trigger change of the label.
When the property is not wrapped, everything works:

Label:
     text: app.myproperty

, where app is

class MyApp(App):
    myproperty = StringProperty("TEST")


Any idea?

Thanks,
Petr

j colo

unread,
Jun 20, 2018, 5:26:41 AM6/20/18
to Kivy users support
using self.parent.myproperty worked for me

e.g
     text: self.parent.myproperty.

It is providing a relative path.....rather than absolute......


No worries, I just had your stupid question a week a go  myself ;-)
Reply all
Reply to author
Forward
0 new messages