-
Notifications
You must be signed in to change notification settings - Fork 24
/
MDExpensionPanel.py
63 lines (49 loc) · 1.46 KB
/
MDExpensionPanel.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
57
58
59
60
61
62
63
from kivymd.app import MDApp
from kivy.uix.screenmanager import Screen,ScreenManager
from kivy.lang import Builder
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd.uix.expansionpanel import MDExpansionPanel, MDExpansionPanelThreeLine
#Builder String
helper_string = '''
<Content>:
adaptive_height: True
TwoLineIconListItem:
text : 'Hello'
secondary_text : 'Sec Text'
IconLeftWidget:
icon: 'phone'
ScreenManager:
Hello:
<Hello>:
name: 'hello'
ScrollView:
MDGridLayout:
id: box
cols:1
adaptive_height : True
'''
class Hello(Screen):
pass
class Content(MDBoxLayout):
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(10):
self.help_str.get_screen('hello').ids.box.add_widget(
MDExpansionPanel(
icon = 'google.png',
content = Content(),
panel_cls= MDExpansionPanelThreeLine(
text = 'Text 1',
secondary_text= 'sec text',
tertiary_text = 'ter text'
) )
)
DemoApp().run()