在屏幕上将屏幕添加到屏幕管理器中,它告诉我屏幕不存在

时间:2020-05-23 14:44:23

标签: python for-loop kivy

我已经使用for循环在屏幕管理器中添加了屏幕,当我尝试转到屏幕时,kivy告诉我该屏幕不存在。另一件事是,我告诉它不打印屏幕的名称,而是打印它。当我尝试转到该屏幕时,它说它不存在。这是我的代码。我将不胜感激。

    def thecontinue8(self, *args):
        app = App.get_running_app()
        print(self.getmessages.result)
        for key, value in self.getmessages.result.items():
            self.keylist = []
            self.keylist.append(key)
            for key in self.keylist:
                self.chatscreen = Chat(name= f"{key}chat", id = f"{key}chat")
                self.chatlist = []
                self.chatlist.append(self.chatscreen)
                self.windowmanager = WindowManager()
                self.windowmanager.add_widget(self.chatscreen)
                for screens in self.chatlist:
                    self.sendbutton =  Button(text="Send", font_size = 20, font_name= "fonts/Qanelas-Heavy.otf", background_color= (0.082, 0.549, 0.984, 1.0), background_normal= '', pos_hint= {"right": 1,"down": 1}, size_hint= [0.2, 0.1])
                    self.textinput = TextInput(width=Window.size[0]*0.8, hint_text= "Write a message", font_name= "fonts/Qanelas-Light.otf", size_hint= [0.8, 0.1], pos_hint= {"left": 1,"down": 1})
                    self.scrollview = ScrollView(pos_hint= {"center_x": 0.5, "center_y": 0.5}, size_hint= (1, 0.8))
                    self.boxlayout = ChatLayout()
                    self.chatscreen.add_widget(self.sendbutton)
                    self.chatscreen.add_widget(self.textinput)
                    self.chatscreen.add_widget(self.scrollview)
                    self.scrollview.add_widget(self.boxlayout)
                    print(self.chatlist[0].name)
                    sm = WindowManager()
                    sm.current = "AdefemiTemitayochat"


0 个答案:

没有答案