title: How to return a widget inside a Layout in Kivy?
body: <p>I made a very simple Kivy application in which I have different layouts. I need to split my app into a <code>GridLayout(rows=2)</code>, this way I can have a "header" at the top of the screen, and a <code>carousel</code> or <code>accordion</code> in the rest of the screen.</p>
  
  <p>My problem is that I can't figure out how to return my widget inside the layout.</p>
  
  <p>Here's my code :</p>
  
  <pre><code>class Logo(App):
  
      def build(self):
          layout = GridLayout(rows=2)
          layoutTop = FloatLayout()
          layoutMid = FloatLayout()
  
          logo = Image(source='imagine.png',size_hint=(.25,.25),pos=(30,380))
          titre = Label(text='#LeCubeMedia',font_size='40sp',pos=(0,280))
          ip = Label(text='192.168.42.1',font_size='25sp',pos=(250,280))
  
          carousel = Carousel(direction='right', loop = True, size_hint=(.5,.5),pos=(300,180))
          for i in range(2):
                  src = "imagine.png"
                  image = Factory.AsyncImage(source=src, allow_stretch=True)
                  carousel.add_widget(image)
                  Clock.schedule_interval(carousel.load_next, 1)
          return carousel ------&gt; 1st Return
  
          layoutTop.add_widget(titre)
          layoutTop.add_widget(logo)
          layoutTop.add_widget(ip)
          layoutMid.add_widget(carousel)
  
          layout.add_widget(layoutTop)
          layout.add_widget(layoutMid)
  
          return layout ------&gt; 2nd Return
  
  if __name__ == '__main__':
  
      Logo().run()
  </code></pre>
  
  <p>As you can see, I need those 2 <code>return</code> in order to display my carousel inside my layout, but this way only the carousel will appear in my app. If I delete the <code>return carousel</code>, it will fail at swiping Images, a bit like there's a layout refresh that prevent the carousel from passing images normally.</p>
  
  <p>Any ideas how I can re-structure the code to have a good carousel inside my layout ?</p>