It’s usually best to keep all knowledge of a Form’s structure within the Form itself, so if the Form structure changes, all the code that needs to change is within the Form.
This can usually be achieved with get_open_form()
.
In your case, you could create an event handler on the Form that knows how to update the Label:
# In the main Form
def __init__(self, **properties):
# ...
self.set_event_handler('x-update-label', self.update_label)
def update_label(self, new_text, **event_args):
self.label_1.text = new_text
Then raise the event from the lost_focus
event:
# In the Data Row Panel
def text_box_1_lost_focus(self, **event_args):
"""This method is called when the TextBox loses focus"""
get_open_form().raise_event('x-update-label', new_text=self.text_box_1.text)
So the Data Row Panel is responsible for the TextBox within it, and the Form is responsible for the Label.