However, examples from the official document have shown the basics of this widget. But for newbies, it is easy to write an unworking widget due to a lack of understanding of it.
Quick Start
from kivy.uix.gridlayout import GridLayout from kivy.uix.button import Button from kivy.uix.scrollview import ScrollView from kivy.core.window import Window from kivy.app import runTouchApp
layout = GridLayout(cols=1, spacing=10, size_hint_y=None) ## Make sure the height is such that there is something to scroll. layout.bind(minimum_height=layout.setter('height')) for i inrange(100): btn = Button(text=str(i), size_hint_y=None, height=40) layout.add_widget(btn) root = ScrollView(size_hint=(1, None), size=(Window.width, Window.height)) root.add_widget(layout)
runTouchApp(root)
Why Am I failed to scroll my widget
The problem is that after you settled everything in your kv file, the sub-widget has the same size as the ScrollView widget by default. So, to have a functional scrolling behavior, you’d like to make sure the sub-widget is larger than the ScrollView widget. Let’s go back to the example from the document:
MyButton: text: 'hit me 1' MyButton: text: 'hit me 2' MyButton: text: 'hit me 3' MyButton: text: 'hit me 4' MyButton: text: 'hit me 5' MyButton: text: 'hit me 6'