title: How to pass properties from one class to another in kivy
body: <p>In my application, I have multiple screens. Each screen corresponds to a class. Now I would like to display a property that was calculated in a certain class (screen) on another screen. Below is a simplified example to outline my problem. In the class WordComprehension, the NumericProperty count_r is incremented, every time the button is pressed. Now, I would like to display the result of this calculation in the ScoreScreen. Thanks for your suggestions.
  Here is the .py:</p>
  
  <pre><code>import kivy
  from kivy.app import App
  
  from kivy.uix.boxlayout import BoxLayout
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.label import Label
  from kivy.uix.button import Button
  
  from kivy.properties import ObjectProperty
  from kivy.properties import NumericProperty
  
  
  class AppScreen(FloatLayout):
      app = ObjectProperty(None)
  
  class MainMenu(AppScreen):
      pass
  
  class ScoreScreen(AppScreen):
  
      score = NumericProperty(0)
      def get_score(self):
          wordcomp = WordComprehension()
          self.score = wordcomp.count_r
  
  
  class WordComprehension(AppScreen):
      count_r = NumericProperty(0)
      count_w = NumericProperty(0)
  
      def do_something(self):
          self.count_r += 1
  
  
  class InterfaceApp(App):
      def build(self):
          self.screens = {}
          self.screens["wordcomp"] = WordComprehension(app=self)
          self.screens["menu"] = MainMenu(app=self)
          self.screens["score"] = ScoreScreen(app=self)
          self.root = FloatLayout()
          self.goto_screen("menu")
          return self.root
  
      def goto_screen(self, screen_name):
          self.root.clear_widgets()
          self.root.add_widget(self.screens[screen_name])
  
  
  if __name__ == "__main__":
      InterfaceApp().run()
  </code></pre>
  
  <p>and the .kv:</p>
  
  <pre><code>#:kivy 1.8.0
  
  &lt;MainMenu&gt;:
      BoxLayout:
          orientation: 'vertical'
          Label:
              text: "Choose Category"
              font_size: 30 
          Button:
              text: 'Word Comprehension'
              on_press: root.app.goto_screen("wordcomp")
          Button:
              text: 'Highscore'
              on_press: root.app.goto_screen("score")
              disabled: False
  
  &lt;ScoreScreen&gt;:
      BoxLayout:
          orientation: 'vertical'
          Button:
              text: 'get score'
              on_press: root.get_score()
          Label:
              text: "Word Comprehension right answers:" + str(root.score)
          Button:
              text: 'Main Menu'
              on_release: root.app.goto_screen("menu")
  
  
  &lt;WordComprehension&gt;:
      BoxLayout:
          orientation: 'vertical'
          Label:
              text: str(root.count_r)
          Button:
              text: 'Do something'
              on_release: root.do_something()
          Button:
              text: 'Menu'
              on_press: root.app.goto_screen("menu")
  </code></pre>