scrollview example without kv file

Showing 1-2 of 2 messages
scrollview example without kv file Rodrigo Liberal 7/11/12 4:02 PM
I was trying to implement the scrollview example without the kv file but I am finding it difficult.
Do you have a version like that?
Re: scrollview example without kv file qua-non 7/26/12 6:33 AM

from kivy.app import App
from kivy.uix.scrollview import ScrollView
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label

class SMApp(App):

    def build(self):
        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 in range(30):
            btn = Label(text=str(i), size_hint_y=None, height=40)
            layout.add_widget(btn)
        root = ScrollView(size_hint=(None, None), size=(400, 400),
            pos_hint={'center_x':.5, 'center_y':.5})
        root.add_widget(layout)
        return root

if __name__ == '__main__':
    SMApp().run()
This is actually taken from the documentation, http://kivy.org/docs/api-kivy.uix.scrollview.html#managing-the-content-size
I'm curious what part were you having difficulty with?