gpt4 book ai didi

python - wxPython textCtrl 静默 AppendText

转载 作者:行者123 更新时间:2023-12-01 06:02:52 28 4
gpt4 key购买 nike

我有一个文本(有多行),需要将其放入 wxPython TextCtrl 中。
问题是其中一些行包含无法打印的字符。

我的解决方案是使用 AppendText,并 try catch 有问题的行。

当前的问题是,对于大量行,需要花费大量时间(相对于准备包含所有行的大字符串并使用 SetValue)

有没有办法“默默地”将文本行附加到 TextCtrl(这样它就不会在每行之后重新绘制)?

最佳答案

wxTextCtrl源自wxWindow ,它继承了它的 Freeze()Thaw()方法。

Freeze() 将锁定控件的屏幕更新,而 Thaw() 将重新启用它们。该文档实际上提到了您的用例,尽管有一个警告:

This method is useful for visual appearance optimization (for example, it is a good idea to use it before doing many large text insertions in a row into a wxTextCtrl under wxGTK) but is not implemented on all platforms nor for all controls so it is mostly just a hint to wxWidgets and not a mandatory directive.

关于python - wxPython textCtrl 静默 AppendText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9392088/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com