title: Using Kivy screens, how do I change the label from screen 2 based on the pressed button's text on screen 1?
body: <p>I'm using 2 files with this process, the first being <code>main.py</code> and the second <code>ScreenManagement.kv</code> I've tried so many different &quot;solutions&quot; from Stack and other sites but nothing is working for me. I want to be able to click a button, and the button will take me to the next screen but also set the label in that screen to the text of the button from the first screen.</p>
  <p>I labeled the button, label, and screens in question with comments. Thank you in advance for your help as this has been an ongoing problem :)</p>
  <p>main.py</p>
  <pre><code>from kivy.app import App
  from kivy.graphics import Color, Rectangle
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.gridlayout import GridLayout
  from kivy.uix.button import Button
  from kivy.uix.label import Label
  from kivy.uix.textinput import TextInput
  from kivy.uix.colorpicker import ColorPicker
  from py.fileImport import readMachine
  from kivy.lang import Builder
  from kivy.uix.anchorlayout import AnchorLayout
  from kivy.uix.stacklayout import StackLayout
  from kivy.uix.boxlayout import BoxLayout
  from kivy.uix.screenmanager import Screen, ScreenManager, NoTransition
  from kivy.properties import StringProperty
  
  Builder.load_file(&quot;kv/ScreenManagement.kv&quot;)
  
  class MainOverview(Screen): #This is the first screen in question
      selectedMachine = StringProperty(&quot;&quot;)
  class MachineStatusPage(Screen): #This is the second screen in question
      selectedMachine = StringProperty(&quot;test&quot;)
  class AddMachinePage(Screen):
      pass
  class AddJobPage(Screen):
      pass
  
  class MainApp(App):   
  
      def build(self):
          
          self.root = root = ScreenManager()
          root.bind(size=self._update_rect, pos=self._update_rect)
          screen1 = MainOverview(name='MainOverview')
          screen2 = MachineStatusPage(name='MachineStatusPage')
          screen3 = AddMachinePage(name='AddMachinePage')
          screen4 = AddJobPage(name='AddJobPage')
          root.add_widget(screen1)
          root.add_widget(screen2)
          root.add_widget(screen3)
          root.add_widget(screen4)
          
  
          with root.canvas.before:
              Color(0, 1, 1, .6)  # colors range from 0-1 not 0-255
              self.rect = Rectangle(size=root.size, pos=root.pos)
          return root
  
      def _update_rect(self, instance, value):
          self.rect.pos = instance.pos
          self.rect.size = instance.size
  
  if __name__ == '__main__':
      MainApp().run()
  </code></pre>
  <p>ScreenManagement.kv</p>
  <pre><code>#:kivy 1.10.1
  #: import NoTransition kivy.uix.screenmanager.NoTransition
  
  &lt;AnchorGridCell@AnchorLayout&gt;:
      anchor_x: 'center'
      anchor_y: 'center'
  &lt;SubmitButton@Button&gt;:
      text: 'Submit'
      font_size: self.width / 8
      size_hint: .4, .1
  &lt;CancelButton@Button&gt;:
      text: 'Cancel'
      font_size: self.width / 8
      size_hint: .4, .1
  &lt;MachineButton@Button&gt;:
      font_size: self.width / 20
      text_size: self.size
      halign: 'center'
      valign: 'center'
  &lt;MachineStatusButton@Button&gt;:
      font_size: self.width / 9
      text_size: self.size
      halign: 'center'
      valign: 'center'
      size_hint: .3, .06
  &lt;XButton@Button&gt;:
      text: 'X'
      size_hint: None, None
  &lt;InputLabel@Label&gt;:
      font_size: self.width / 8
      text_size: self.size
      halign: 'left'
      valign: 'center'
  &lt;OutputLabel@Label&gt;:
      font_size: self.width / 8
      text_size: self.size
      halign: 'right'
      valign: 'center'
  &lt;TextCollection@TextInput&gt;:
      multiline: False
      size_hint: 1, .7
      font_size: self.width / 7
      
  &lt;ScreenManager&gt;
      transition: NoTransition()
      MainOverview:
          id: mainOverview
      MachineStatusPage:
          selectedMachine: mainOverview.selectedMachine
  &lt;MainOverview&gt;:
      FloatLayout:
          AnchorLayout:
              anchor_x: 'center'
              anchor_y: 'top'
              GridLayout:
                  cols: 1
                  row_force_default: True
                  row_default_height: self.width / 13
                  padding: self.width / 15
                  AnchorLayout:
                      anchor_x: 'center'
                      anchor_y: 'bottom'
                      Label:
                          text: 'All Currently Added Machines'
                          text_size: self.size
                          font_size: self.width / 16
                          halign: 'center'
                          valign: 'bottom'
                  AnchorLayout:
                      anchor_x: 'center'
                      anchor_y: 'top'
                      GridLayout:
                          cols: 1
                          row_force_default: True
                          row_default_height: self.width / 8
                          col_default_width: self.width / 4
                          padding: self.width / 25
                          spacing: self.width / 25, self.width / 50
                          AnchorGridCell:
  
  ###############################################################################
  
                              MachineButton: #This button is the one in question
                                  id: machine1
                                  text: &quot;Tsugami 5&quot;
                                  on_press: root.selectedMachine = machine1.text; root.manager.current = 'MachineStatusPage'
  
  ###############################################################################
  
                          AnchorGridCell:
                              MachineButton:
                                  text: 'Tsugami 6'
                                  on_press: root.manager.current = 'MachineStatusPage'
                          AnchorGridCell:
                              MachineButton:
                                  text: 'Tsugami 7'
                                  on_press: root.manager.current = 'MachineStatusPage'
                          AnchorGridCell:
                              MachineButton:
                                  text: 'Tsugami 8'
                                  on_press: root.manager.current = 'MachineStatusPage'
              AnchorLayout:
                  anchor_x: 'right'
                  anchor_y: 'bottom'
                  MachineButton:
                      text: 'Add New Machine'
                      font_size: self.width / 8
                      size_hint: .4, .1
                      on_press: root.manager.current = 'AddMachinePage'
                                      
                                  
  &lt;MachineStatusPage&gt;:
      FloatLayout:
          AnchorLayout:
              anchor_x: 'center'
              anchor_y: 'top'
              GridLayout:
                  cols: 1
                  rows: 2
                  row_force_default: True
                  row_default_height: self.width / 13
                  padding: self.width / 8
                  AnchorLayout:
                      anchor_x: 'center'
                      anchor_y: 'bottom'
  
  #####################################################################
  
                      Label: #This label is the label in question
                          id: selectedMachine
                          text: root.selectedMachine
                          text_size: self.size
                          font_size: self.width / 12
                          halign: 'center'
                          valign: 'bottom'
  
  #####################################################################
  
                  AnchorLayout:
                      anchor_x: 'center'
                      anchor_y: 'top'
                      GridLayout:
                          cols: 2
                          row_force_default: True
                          row_default_height: self.width / 8
                          col_default_width: self.width / 4
                          padding: self.width / 25
                          spacing: self.width / 25, self.width / 50
                          AnchorGridCell:
                              InputLabel:
                                  text: 'Current Job: '
                          AnchorGridCell:
                              OutputLabel:
                                  text: '414-44-1'
                          AnchorGridCell:
                              InputLabel:
                                  text: 'Parts Left: '
                          AnchorGridCell:
                              OutputLabel:
                                  text: '250'
                          AnchorGridCell:
                              InputLabel:
                                  text: 'Time Left: '
                          AnchorGridCell:
                              OutputLabel:
                                  text: '3 Days'
              AnchorLayout:
                  anchor_x: 'left'
                  anchor_y: 'bottom'
                  Button:
                      text: 'Go Back'
                      font_size: self.width / 8
                      size_hint: .4, .1
                      on_press: root.manager.current = 'MainOverview'
              AnchorLayout:
                  anchor_x: 'right'
                  anchor_y: 'bottom'
                  Button:
                      text: 'Add New Job'
                      font_size: self.width / 8
                      size_hint: .4, .1
                      on_press: root.manager.current = 'AddJobPage'
  
  </code></pre>