Обновление RstDocument в Kivy - PullRequest
0 голосов
/ 10 июля 2020

Я использовал RstDocument для отображения выходного текста, мне нравится часто обновлять текст в RstDocument. Но обновление не работает.

class fi(App)
 def build(self):
    self.title = "TOOL"
    self.root = BoxLayout(orientation="vertical")
    
    self.out2 = BoxLayout(orientation="horizontal")
    self.document = """

TOOLs \n

"""
    self.sh ="""
    
    .. _myreff:
    
    @#$


"""
    self.document += self.sh
    
    self.rst = RstDocument(text=self.document, colors={'paragraph':'ce5c00ff', 'background':'000000ff'},)
    if(Clock.schedule_once(partial(self.rst.goto, 'myreff'), 4)):
        print("build_good")
    self.rst.render()
    self.out2.add_widget(self.rst)
    self.root.add_widget(self.out2)
    return self.root

 def job_process(self, show_text=""""""):
    self.sh ="""
    
    .. _myreff:
    
    @#$


"""

    if(self.sh in self.document):
        time.sleep(2)
        self.document = self.document.replace(self.sh, "")
        print(self.document)
        time.sleep(2)
    self.document = self.document + """ \n """ 
    self.document = self.document + show_text + self.sh
    print(self.document)
    time.sleep(2)
    return()

Когда некоторые вычисления завершены, я вызвал функцию job_process("some text"), чтобы обновить self.document, чтобы распечатать обновленный вывод. Но это не обновление. Я не знаю, в чем проблема. Никаких предупреждений, никаких ошибок от RstDocument () Спасибо

...