Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
GetLineText 非常适合获取特定的行,但没有对应的 SetLineText。如果存在的话,那就是我正在寻找的东西。既然它似乎没有,那么处理这个问题的最佳方法是什么?
注意:我不想每次都替换所有文本,因为我担心性能。我的用例让我为另一个控件中的每个字符更改替换一行(或行范围)。因此,让我调用 SetValue 的解决方案不是我想要的。
我认为您正在寻找的是 Replace() 方法:
替换(自我,从,到,价值)
http://wxpython.org/docs/api/wx.TextCtrl-class.html