I think I found the solution. I don’t understand why it works with dictionaries and not with texts, but now I have a working custom component.
Here are the steps to get the custom component text property to play nice with the data binding:
-
In the Use as component dialog:
- create the change event
- create the text property
- check the allow data binding write-back in the text property settings
- choose the change event in the drop down
-
raise the change event when the text changes:
def text_box_change (self, **event_args): self.raise_event('change', **event_args)
-
create both the getter and the setter for the text property:
@property def text(self): return self.text_box.text @text.setter def text(self, value): self.text_box.text = value