Wxpython add string to TextCtrl

I have a multiline string, only TextCtrl text in wxpython I know how to set values ​​with

myTextCtrl.SetValue('hello')

But this will change everything that I previously had in my TextCtrl ... How to add a new line and save everything that I had before?

+3
source share
3 answers

Either widget.AppendText, or it widget.WriteTextwill write a new line every time if you send a line with a newline (for example, 'hello \ n')

AppendText, will add text at the end of the text in the control. WriteTextthe same thing, except that new text is placed at the current insertion point.

+7
source

, , , .

widget.TextCtrl, (\n), :

1) wx.TE_MULTILINE "style" .

2) widget.TextCtrl widget.SetValue, widget.SetLabel, . widget.SetLabel , , .

+1
myTextCtrl.AppendText('hello')

, , .

0

All Articles