title: How to change screen in Python if Screen Manager is defined in kivy file?
body: <p>My program takes input in one screen and then goes and displays it in to another. I want to make a condition that the screen only changes when the value is digit greater than 0.
  My screen manager is defined in kivy file.
  My question is how to use this "root.manager.current = "SecondScreen"" command in my condition. I don't know how to reference it.
  Or maybe there is a way to make condition in .kv file?</p>
  
  <p>main.py</p>
  
  <pre><code>    from kivy.app import App
      from kivy.properties import StringProperty, NumericProperty, ObjectProperty
      from kivy.uix.floatlayout import FloatLayout
      from kivy.uix.screenmanager import ScreenManager, Screen
      from kivy.uix.textinput import TextInput
      from kivy.properties import StringProperty, NumericProperty, ObjectProperty
  
      global var
      global pp
      pp = '0'
      class FirstScreen(Screen):
          global pp
          ppp = StringProperty('')
          def g(self, text):
              global pp
              if text.isdigit() and int(text) &gt; 0:
                  pp = text
  </code></pre>
  
  <p>my test.kv file</p>
  
  <pre><code>ScreenManager:
      id: screen_manager
      FirstScreen:
          id: screen1
          name: "FirstScreen"
          manager: screen_manager
      SecondScreen:
          id: screen2
          name: "SecondScreen"
          manager: screen_manager
  &lt;FirstScreen&gt;:
      text_input: text_input
      FloatLayout:
          id: fl1
          canvas.before:
              Color:
                  rgba: 0.1, 0.1, 0.1, 1
              Rectangle:
                  # self here refers to the widget i.e BoxLayout
                  pos: self.pos
                  size: self.size
          TextInput:
              id: text_input
              text: root.ppp
              multiline: False
              size_hint_x: .4
              size_hint_y: .1
              pos_hint: {'x': .1, 'y': .20}
          Button:
              background_color: 0.2, 0.7, 1, 1,
              font_size: root.width / 15
              id: btn1
              text: "Next"
              on_press:
                  root.g(text_input.text)
                  root.manager.current = 'SecondScreen'
              size_hint_x: .4
              size_hint_y: .1
              pos_hint: {'x': .5, 'y': .20}
  &lt;SecondScreen&gt;:
      on_enter: root.f()
      FloatLayout:
          id: fl2
          canvas.before:
              Color:
                  rgba: 0.1, 0.1, 0.1, 1
              Rectangle:
                  # self here refers to the widget i.e BoxLayout
                  pos: self.pos
                  size: self.size
          Label:
              color: 0.2, 0.7, 1, 1,
              font_size: 15
              id: lb1
              text: root.idf
              size_hint_y: .2
              pos_hint: {'x': .1, 'y': .8}
  </code></pre>