Q:

Edit a Widget in Kv

I have a widget that I defined in Kv language, which exists within a layout that I also defined in Kv language. I would like to change the text of the widget in the layout in Kv. How would I go about is?
Python code:
import kivy
kivy.require('1.11.1')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

class Test(BoxLayout):
    pass

class KivyTestApp(App):
    def build(self):
        return Test()

app = KivyTestApp()
app.run()

Kv code:
<Header@BoxLayout>:
    orientation: 'horizontal'
    size_hint_y: 0.2

    Button:
        text: 'Button 1'
    Button:
        id: edit_but

<Test>:
    orientation: 'vertical'

    Header:
        edit_but.text: 'Button 2'
        # How do I do this ^ ?
    Label:
        text: 'Filler'

A:

In your kv, you can add a Property to your Header rule (I named it edit_text). That property can be used to set the text of the Button by using text: root.edit_text. That Property can be set whenever you use the Header in kv as edit_text: 'Button 2':
<Header@BoxLayout>:
    orientation: 'horizontal'
    size_hint_y: 0.2
    edit_text: ''

    Button:
        text: 'Button 1'
    Button:
        id: edit_but
        text: root.edit_text

<Test>:
    orientation: 'vertical'

    Header:
        edit_text: 'Button 2'
        # How do I do this ^ ?
    Label:
        text: 'Filler'

