A silly question- how do you capture a carriage return \n in a text box?
Do you mean detect when enter is pressed? If so there’s a “pressed_enter” event for a text box.
Or did you mean something else?
Do you want a TextBox or a TextArea?
A TextBox
contains a single line. Pressing Enter in that box triggers the pressed_enter
event.
A TextArea
contains multiple lines. Pressing Enter in that box inserts a newline (\n
) character.
1 Like
If you meant TextArea
then you could check on the “change” event the last character and see if it’s a newline character. Eg (untested) :
if TextArea.text.endswith("\n"):
do_something
Ah - thanks. I was trying to let the user enter a slightly longer text field with a couple paragraphs. I just needed to user the TextArea vs TextBox. Thx.