I need to create a screen as a history of your results form test, which was in another screens. I want use an MDExpansionPanel, but when I wrote a code nothing is shown. Screen is empty I don't know why, could anybody please help me?
In main.py
class GoalsScreen(Screen):
pass
class Content(BoxLayout):
pass
class HistoryScreen(Screen):
def on_start(self):
names = ["test1", "test2", "test3"]
for name in names:
panel= MDExpansionPanel(icon="1.png",title= name,
content=Content())
self.root.ids.panel_container.add_widget(panel)
class MainApp(MDApp):
def build(self):
self.theme_cls.primary_palette = "Red"
self.theme_cls.primary_hue = "500"
self.theme_cls.theme_style = "Light"
screen = Builder.load_string(screen_helper)
return screen
MainApp().run()
In .kv
screen_helper = """
ScreenManager:
GoalsScreen:
HistoryScreen:
<GoalsScreen>:
name: "goals"
Button:
text: "next page"
on_press: root.manager.current= "history"
<Content>
size_hint: 1,None
height: self.minimum_height
Button:
size_hint: None, None
MDIconButton:
icon: "close"
<HistoryScreen>:
name: "history"
BoxLayout:
ScrollView:
GridLayout:
cols: 1
size_hint_y: None
height: self.minimum_height
id: panel_container