Python 我无法在我的kivymd标签上显示列表

Python 我无法在我的kivymd标签上显示列表,python,python-3.x,kivy,kivy-language,kivymd,Python,Python 3.x,Kivy,Kivy Language,Kivymd,我正在尝试用kivymd创建一个聊天应用程序,但我无法在聊天tad屏幕上显示我的列表。我得到一个错误: Traceback (most recent call last): File "kivy\properties.pyx", line 860, in kivy.properties.ObservableDict.__getattr__ KeyError: 'list' During handling of the above exception, anothe

我正在尝试用kivymd创建一个聊天应用程序,但我无法在聊天tad屏幕上显示我的列表。我得到一个错误:

Traceback (most recent call last):
   File "kivy\properties.pyx", line 860, in kivy.properties.ObservableDict.__getattr__
 KeyError: 'list'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "c:/Users/Allano/Desktop/help/main.py", line 70, in <module>
     MainApp().run()
   File "C:\Users\Allano\Anaconda3\lib\site-packages\kivy\app.py", line 854, in run
     self.dispatch('on_start')
   File "kivy\_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
   File "c:/Users/Allano/Desktop/help/main.py", line 60, in on_start
     self.new_message("ERIK SANDBERG", "Hello World", "kivymd_logo.png")
   File "c:/Users/Allano/Desktop/help/main.py", line 65, in new_message
     self.root.ids.list.add_widget(new_message)
   File "kivy\properties.pyx", line 863, in kivy.properties.ObservableDict.__getattr__
 AttributeError: 'super' object has no attribute '__getattr__
千伏

 MDScreen:
    name: "login"
    
    Screen:
        MDBoxLayout:
            orientation: "vertical"
           
    MDRaisedButton:
        text: 'Enter'
        elevation: 2
        font_size: 35
        width: dp(200)
        elevation_nomal: 8
        size_hint: 0.85,0.06
        pos_hint: {'center_x':0.5,'center_y':0.38}
        on_press:
            root.manager.transition.direction = 'left' 
            root.manager.current = "main"
       
main.py

import os
from kivy.animation import Animation
from kivy.lang import Builder
from kivymd.app import MDApp
from kivy.factory import Factory
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivymd.uix.picker import MDDatePicker
from kivy.core.window import Window
from kivy.uix.modalview import ModalView
from kivymd.uix.filemanager import MDFileManager
from kivymd.theming import ThemableBehavior
from kivy.properties import(
    ListProperty,
    NumericProperty,
    ObjectProperty,
    OptionProperty,
    StringProperty,
    BooleanProperty,
)
from kivymd.toast import toast
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton, MDFillRoundFlatButton
from kivymd.uix.menu import MDDropdownMenu 
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivymd.uix.list import TwoLineAvatarIconListItem
from kivymd.uix.snackbar import Snackbar
from kivymd.uix.bottomsheet import MDCustomBottomSheet
from kivy.uix.button import Button
from kivymd.uix.useranimationcard import MDUserAnimationCard
from kivymd.uix.tab import MDTabsBase
from kivymd.uix.list import ImageLeftWidget

class Tabs(FloatLayout, MDTabsBase):
    '''Class implementing content for a tab on home screen'''


class MainApp(MDApp):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.title = "Main App"
        self.theme_cls.theme_style = "Dark" 
        self.theme_cls.primary_palette = "Cyan"
        self.theme_cls.primary_hue = "600"
        

    def change_screen(self,name):
        screen_manager.current = name

    def build(self):
        global screen_manager
        screen_manager = ScreenManager()
        screen_manager.add_widget(Builder.load_file("login.kv"))
        screen_manager.add_widget(Builder.load_file("Main.kv"))
        return screen_manager

    def on_start(self):
        self.new_message("ERIK SANDBERG", "Hello World", "kivymd_logo.png")
    
    def new_message(self, name, message, image_name):
        new_message = TwoLineAvatarIconListItem(text=name, secondary_text=message)
        new_message.add_widget(ImageLeftWidget(source=image_name))
        self.root.ids.list.add_widget(new_message)

 

if __name__ == "__main__":
    MainApp().run()



    

Main.kv

Screen:
    name: "main"

    [...]
main.py

class MainApp(MDApp):

    [...]

    def new_message(self, name, message, image_name):
        [...]
        screen_manager.get_screen("main").ids.list.add_widget(new_message)
class MainApp(MDApp):

    [...]

    def new_message(self, name, message, image_name):
        [...]
        screen_manager.get_screen("main").ids.list.add_widget(new_message)