title: How to bind a widget to a value from Kivy App
body: <p>I have the following Kivy app and I'm trying to change the text of a Label based on another widget's variable.</p>
  
  <p>I mean, if the variable <em>testing</em> of the class <strong>TestApp</strong> changes, I want also the value of the variable <em>text</em> of the class <strong>TestLabel</strong> to change.</p>
  
  <p>To do so, I've created a <em>BooleanProperty</em> in the <strong>TestLabel</strong> class that points to the <em>testing</em> variable of the <strong>TestApp</strong> class. The problem is that this callback is never executed despite being changing it each time I press the button.</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.button import Button
  from kivy.uix.label import Label
  from kivy.uix.boxlayout import BoxLayout
  from kivy.lang import Builder
  from kivy.properties import BooleanProperty
  
  Builder.load_string('''
  &lt;MainApp&gt;:
      orientation: 'horizontal'
      rows: 2
  
      TestButton:
          text: 'Change value'
          on_release: self.change_value()
      TestLabel:
  ''') 
  
  
  class TestLabel(Label):
      testing = BooleanProperty()
  
      def __init__(self, **kwargs):
          super(TestLabel, self).__init__(**kwargs)
          self.app = App.get_running_app()
          self.testing = self.app.testing
          self.bind(testing=self.changed_value)
  
      def changed_value(self, _instance, newvalue):
          self.text = str(newvalue)
  
  
  class TestButton(Button):
  
      def __init__(self, **kwargs):
          super(TestButton, self).__init__(**kwargs)
          self.app = App.get_running_app()
  
      def change_value(self):
          self.app.testing = not self.app.testing
  
  
  class MainApp(BoxLayout):
      pass
  
  
  class TestApp(App):
      testing = BooleanProperty(False)
  
      def build(self):
          return MainApp()
  
  
  if __name__ == '__main__':
      TestApp().run()
  </code></pre>