forked from Priyanshu-server/kivyAndKivyMD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MdLIST.py
56 lines (41 loc) · 1.38 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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,ThreeLineListItem
#Builder String
helper_string = '''
ScreenManager:
Hello:
<Hello>:
name: 'hello'
ScrollView:
MDList:
id: ls
OneLineListItem:
text: 'Hello'
TwoLineListItem:
text : 'Item 2'
secondary_text: ' text2'
ThreeLineListItem:
text:' item2'
secondary_text: 'text 2'
tertiry_text: 'text 3'
'''
class Hello(Screen):
pass
sm = ScreenManager()
sm.add_widget(Hello(name = 'hello'))
class DemoApp(MDApp):
def build(self):
screen = Screen()
self.help_str = Builder.load_string(helper_string)
screen.add_widget(self.help_str)
return screen
# def on_start(self):
# for i in range(20):
# self.help_str.get_screen('hello').ids.ls.add_widget(
# OneLineListItem(text=f'item {i} ')
# )
# self.help_str.get_screen('hello').ids.ls.add_widget(
# TwoLineListItem(text = f'item for twoline {i}',secondary_text= f'text {i}'))
DemoApp().run()