-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMDList.py
42 lines (33 loc) · 1.05 KB
/
MDList.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from kivymd.app import MDApp
from kivy.uix.screenmanager import Screen,ScreenManager
from kivy.lang import Builder
from kivymd.uix.list import MDList,OneLineListItem,TwoLineListItem
Start_string = '''
ScreenManager:
FirstScreen:
<FirstScreen>:
name: 'First'
ScrollView:
MDList:
id:List
'''
class FirstScreen(Screen):
pass
Screen_Manager = ScreenManager()
Screen_Manager.add_widget(FirstScreen(name = 'First'))
class App(MDApp):
def build(self):
screen=Screen()
self.loader_str = Builder.load_string(Start_string)
screen.add_widget(self.loader_str)
self.start_list()
return screen
def start_list(self):
for i in range(30):
self.loader_str.get_screen('First').ids.List.add_widget(
OneLineListItem(text = f"Item{i}")
)
self.loader_str.get_screen('First').ids.List.add_widget(
TwoLineListItem(text = f'this is another list no {i}', secondary_text = f'sub list this is{i}')
)
App().run()