kivy обновление списка

помогите мне обновлять список в приложение при нажатии кнопки.Буду благодарен за любую помощь.

from kivy.lang import Builder
from kivy.properties import ObjectProperty
from kivy.uix.scrollview import ScrollView
#from kivy.uix.image import Image

from kivy.uix.boxlayout import BoxLayout

from kivymd.app import MDApp
from kivymd.uix.list import OneLineListItem

from kivymd.uix.card import MDCardSwipe
from kivy.properties import StringProperty

from kivymd.uix.dialog import MDInputDialog, MDDialog

text_scrolls = ["привет, и чё ?","псс, лайк поставь!"]

KV = '''

<SwipeToDeleteItem>:
    anchor: "right"
    size_hint_y: None
    height: content.height
    type_swipe: "auto"
    on_swipe_complete: app.on_swipe_complete(root)

    MDCardSwipeLayerBox:

    MDCardSwipeFrontBox:

        OneLineListItem:
            id: content
            text: root.text
            _no_ripple_effect: True


<ContentNavigationDrawer>:
BoxLayout:
    orientation: "vertical"

    NavigationLayout:

        ScreenManager:
            id: screen_manager

            Screen:
                name: "screen 1"

                Screen:
                    ScrollView:
                        MDList:
                            id: scroll
                    MDFloatingActionButton:
                        icon: "android"
                        md_bg_color: app.theme_cls.primary_color
                        pos_hint: {"center_x": .5, "center_y": .5}
                        user_font_size: "64sp"
                        on_press:
                            app.show_MDDialog()

        MDNavigationDrawer:
            id: nav_drawer

            ContentNavigationDrawer:
                id: content
                screen_manager: screen_manager
                nav_drawer: nav_drawer
'''

class SwipeToDeleteItem(MDCardSwipe):
    text = StringProperty()

class TestNavigationDrawer(MDApp):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.screen = Builder.load_string(KV)

    def build(self):
        return self.screen

    def on_start(self):
        instance_content = self.root.ids.content

        for text_scroll in text_scrolls:
            self.screen.ids.scroll.add_widget(
                SwipeToDeleteItem(text=text_scroll)
            )
        print(text_scrolls)

    def show_MDDialog(self):
        text_scrolls.append(333)
        print(text_scrolls)
        
    
class ContentNavigationDrawer(ScrollView):
    screen_manager = ObjectProperty()
    nav_drawer = ObjectProperty()


TestNavigationDrawer().run()

Ответы (0 шт):