Loading a data to expansional panel

42 views
Skip to first unread message

John Zuriel

unread,
Feb 6, 2021, 10:28:47 PM2/6/21
to Kivy users support
I'm working now on my recipe screen, but I'm having a problem on how to possibly load the data, and what will I use? is it through json? pickle? shelve? or sqlite?
This is an image of my current recipe screen:
Capture.PNG
And this is I want it to be, after clicking a list is it possible to show a dialog box that contains all the ingredients?
Capture2.PNG
This is the code I use on my current recipe screen
py file:
        for i in range(5):
            self.root.ids.sm.get_screen('menu').ids.rlist.add_widget(
                MDExpansionPanel(
                    icon="recipe.png",
                    content=Content(),
                    panel_cls=MDExpansionPanelTwoLine(
                        text="Text",
                        secondary_text="Secondary text"
                    )
                )
            )
kv file:
<Content>
    adaptive_height: True

    TwoLineListItem:
        text: "testrun"
        secondary_text: "test"

MDBottomNavigation:
            MDBottomNavigationItem:
                name: 'screen 1'
                text: 'List'
                icon: 'home'

            MDBottomNavigationItem:
                name: 'screen 2'
                text: 'Recipe'
                icon: 'food'

                ScrollView:
                    MDList:
                        id: rlist

I badly needed help in here.

John Zuriel

unread,
Feb 6, 2021, 10:34:53 PM2/6/21
to Kivy users support
Idea to this screen is to have a category of meat, fish chicken, vegetables, etc., then after clicking on any category it will expand to bunch of recipes that can show if possible through dialog box if clicked, then can be added to the list using the plus button, hope somebody can help, I will gladly appreciate any help coming.

John Zuriel

unread,
Feb 6, 2021, 11:52:46 PM2/6/21
to Kivy users support
Update #1: Manage to add the plus button, and I use OneLineListItem instead of Two
1.PNG
py:
        for i in range(5):
            self.root.ids.sm.get_screen('menu').ids.rlist.add_widget(
                MDExpansionPanel(
                    icon="recipe.png",
                    content=Content(),
                    panel_cls=MDExpansionPanelTwoLine(
                        text="Text",
                        secondary_text="Secondary text"
                    )
                )
            )

class Content(MDBoxLayout, OneLineListItem):
    pass

kv:
<OneLineListItem>:
    id: onelst
    text: "testrun"
    MDIconButton:
        icon:'plus'

<Content>
    adaptive_height: True
Reply all
Reply to author
Forward
0 new messages