Python Forum
[WxPython] Append string to StaticText - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [WxPython] Append string to StaticText (/thread-12211.html)



Append string to StaticText - giu88 - Aug-14-2018

Hello,

I have a StaticText where i can set the label with
mystaticText.setLabel("Hello")
However, when i use SetLabel, the string showed in the textBox disappeares and is replaced by the new one.
I need to append the new string to the old one, not replacing it, so i can see all the strings, not only the last one.

I tried with
mystaticText.AppendText("hello_2")
but is does not work.

Is there an easy way to do this (i.e. a method) or the only way is to play with strings (i.e. i can append the new string to the last one and then call the SetLabel method)?


Thanks


RE: Append string to StaticText - Windspar - Aug-14-2018

mystaticText.SetLabel(mystaticText.GetLabel() + " hello 2")