title: flexible number of objects in kivy scrollview
body: <p>I am trying to use input on one screen to make a list on a second screen using kivy. The basic idea is that a paragraph is broken up into words, which are then displayed on another page. Below is a minimum example. </p>
  
  <p>What is happening is that the words are getting squished together, and there's no scrolling.</p>
  
  <p>In main.py:</p>
  
  <pre><code>from kivy.app import App
  from kivy.app import Widget
  
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.gridlayout import GridLayout
  from kivy.uix.label import Label
  from kivy.uix.screenmanager import ScreenManager, Screen
  from kivy.properties import ObjectProperty
  
  
  class InputScreen(Screen):
      wordList = ObjectProperty()
      def getwords(self):
          self.wordList=[]
          s = self.ids.textInput.text.split()
          for w in s:
              for punctuation in [',','.','!','?']:
                  w.strip(punctuation)
  
              self.wordList.append(w)
  
          return None
  
  class WordLabel(Label):
      pass
  
  class WordScreen(Screen):
      wordList = ObjectProperty()
      def updateWords(self):
          self.ids.scrollContainer.clear_widgets()
          wordGrid = GridLayout(cols=2,size_hint_y=None)
          wordGrid.bind(minimum_height=wordGrid.setter('height'))
          for w in self.wordList:
              wordGrid.add_widget(Label(text=w))
              wordGrid.add_widget(Label(text='property of word'))
  
          self.ids.scrollContainer.add_widget(wordGrid)
  
  class testScreenManager(ScreenManager):
      pass
  
  class testApp(App):
      def build(self):
          sm = testScreenManager()
          return sm
  
  
  if __name__=='__main__':
      testApp().run()
  </code></pre>
  
  <p>In test.kv:</p>
  
  <pre><code>&lt;testScreenManager&gt;
      InputScreen:
          id: inputScreen
          name: 'input'
      WordScreen:
          id: wordScreen
          name: 'word'
          wordList: inputScreen.wordList
  
  
  &lt;InputScreen&gt;:
      GridLayout:
          cols: 1
          TextInput:
              id: textInput
              hint_text: 'Input paragraph'
          BoxLayout:
              orientation: 'horizontal'
              size_hint_y: .2
              Button:
                  text: 'Analyze paragraph'
                  on_press: root.getwords()
              Button:
                  text: 'See word list'
                  on_press:
                      root.getwords()
                      root.manager.transition.direction = 'left'
                      root.manager.current = 'word'
          BoxLayout:
              orientation: 'horizontal'
              size_hint_y: .2
              Label:
                  id: wordCountResult
                  text: ''
  
  
  &lt;WordScreen&gt;:
      on_enter: root.updateWords()
      BoxLayout:
          orientation: 'vertical'
          BoxLayout:
              id: rowLabels
              orientation: 'horizontal'
              size_hint_y: .2
              Label:
                  text: 'Words not at grade level:'
                  size_hint_x: .5
              Label:
                  text: 'Grade Level'
                  size_hint_x: .5
          ScrollView:
              id: scrollContainer
              size_hint: (None,None)
              size: (self.parent.width,self.parent.height - rowLabels.height - buttonRow.height)
          Button:
              id: buttonRow
              size_hint_y: .2
              text: 'Back'
              on_press:
                  root.manager.transition.direction = 'right'
                  root.manager.current = 'input'
  &lt;WordLabel&gt;:
      size_hint_y: None
      height: '29sp'
  </code></pre>
  
  <p>I've tried using <code>size_hint_y=.6</code> for the ScrollView, and swapping <code>height</code> and <code>minimum_height</code> in the <code>wordGrid.bind(minimum_height=wordGrid.setter('height'))</code>. </p>
  
  <p>What I thought was going to happen, is that the ScrollView container will be the height of the window minus the height used by two other widgets. Inside the ScrollView, WordGrid is longer (the height is bound to the minimum height necessary for all children) and so the scrolling is used to see all the items. I must not be understanding some fact about heights/sizes of ScrollView, WordGrid, and WordGrid's children. Anyone have some insight?</p>