Binding to property wrapped in class

已查看 10 次
跳至第一个未读帖子

Petr Sturc

未读,
2018年6月19日 08:19:432018/6/19
收件人 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

未读,
2018年6月20日 05:26:412018/6/20
收件人 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 ;-)
回复全部
回复作者
转发
0 个新帖子