python - 在 Kivy 中更新 RstDocument
问题描述
我使用 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() 的错误谢谢
解决方案
推荐阅读
- php - TCPDF 问题:如何对齐文本和图像?
- ruby-on-rails - 在范围内使用关联域进行计算
- alphabet - ∑和∑1的区别
- spring - 混合参数策略 - 仅使用命名、位置或 JPA 序数策略之一
- c# - 在 c# 中获取属性的调用者信息
- javascript - 在 angular6 中刷新页面时,用户名将为空
- android-studio - Android Studio Web-view 访问存储的权限?
- python - 为什么图像块在提取时会像素化,但在连接时会变得正常?
- javascript - 我如何将所有这些代码存储在变量中
- python - 为 pip 设置私人仓库需要常规包的密码