mirror of https://github.com/kivy/kivy.git
Added a simple example for listview, that only takes a list of strings.
This commit is contained in:
parent
867061fe4a
commit
fa7009d79d
|
@ -0,0 +1,23 @@
|
|||
from kivy.uix.listview import ListView
|
||||
from kivy.uix.gridlayout import GridLayout
|
||||
|
||||
|
||||
class MainView(GridLayout):
|
||||
'''Implementation of a simple list view with 100 items.
|
||||
'''
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
kwargs['cols'] = 2
|
||||
kwargs['size_hint'] = (1.0, 1.0)
|
||||
super(MainView, self).__init__(**kwargs)
|
||||
|
||||
list_view = ListView([str(index) for index in xrange(100)])
|
||||
|
||||
self.add_widget(list_view)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
from kivy.base import runTouchApp
|
||||
|
||||
runTouchApp(MainView(width=800))
|
Loading…
Reference in New Issue