wxpython 向 TextCtrl 添加行 [英] wxpython add line to TextCtrl

查看:54
本文介绍了wxpython 向 TextCtrl 添加行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多行,在 wxpython 中只读 TextCtrl我知道如何使用

I have a multi line, read only TextCtrl in wxpython I know how to set values using

myTextCtrl.SetValue('hello')

但这将改变我之前在 TextCtrl 中的任何内容...如何添加新行并保留之前的所有内容?

But this will change whatever I previously had in my TextCtrl... How do I add a new line and keep whatever I had before?

推荐答案

无论是 widget.AppendText 还是 widget.WriteText 每次发送你的带有换行符的字符串(如 'hello\n')

Either widget.AppendText or widget.WriteText will write a new line each time if you send your string with a newline character (like 'hello\n')

AppendText,将在控件中的文本末尾附加文本.WriteText 是相同的,只是因为新文本被放置在当前插入点.

AppendText, would append the text at the end of the text in the control. WriteText is the same except because the new text in placed at the current insertion point.

这篇关于wxpython 向 TextCtrl 添加行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆