2011-03-08 23:31:12 +00:00
|
|
|
from kivy.app import App
|
|
|
|
from kivy.core.window import Window
|
|
|
|
from kivy.uix.button import Button
|
|
|
|
from kivy.uix.scrollview import ScrollView
|
|
|
|
from kivy.uix.gridlayout import GridLayout
|
|
|
|
|
2011-03-24 17:19:35 +00:00
|
|
|
|
|
|
|
class ScrollViewApp(App):
|
|
|
|
|
2011-03-08 23:31:12 +00:00
|
|
|
def build(self):
|
2011-03-24 17:19:35 +00:00
|
|
|
layout = GridLayout(cols=1, spacing=10, size_hint=(None, None),
|
|
|
|
width=500)
|
|
|
|
for i in range(30):
|
2011-06-17 08:49:19 +00:00
|
|
|
btn = Button(text=str(i), size=(480, 40),
|
|
|
|
size_hint=(None, None))
|
2011-03-08 23:31:12 +00:00
|
|
|
layout.add_widget(btn)
|
|
|
|
|
|
|
|
root = ScrollView(size_hint=(None, None))
|
2011-03-24 17:19:35 +00:00
|
|
|
root.size = (480, 320)
|
2011-03-08 23:31:12 +00:00
|
|
|
root.center = Window.center
|
|
|
|
root.add_widget(layout)
|
|
|
|
|
|
|
|
return root
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2011-03-24 17:19:35 +00:00
|
|
|
ScrollViewApp().run()
|