text formatting
-
Dear all,
I want to ask if there is a way and if someone know how is possible with UIFlow to take the text with some space and empty line and convert it in a text with each word in one different line. Thank you and regards.Example:
text BEFORE:
TEXT1 TEXT2TEXT3
text AFTER:
TEXT1
TEXT2
TEXT3 -
Hi,
wiht the Execute code of the advanced section you can enter python code, because if you take the replace block in the text section the '\n' will be changed by UIFlow into '\n'.
See my UIFlow-Example:
... and the following is the python code of my example:
from m5stack import *
from m5ui import *
from uiflow import *setScreenColor(0x222222)
label0 = M5TextBox(0, 30, "Text", lcd.FONT_DejaVu18,0xFFFFFF, rotate=0)
label1 = M5TextBox(0, 120, "Text", lcd.FONT_DejaVu18,0xFFFFFF, rotate=0)
rectangle0 = M5Rect(0, 100, 320, 5, 0xFFFFFF, 0xFFFFFF)str_original = None
str_parse = Nonestr_original = ''
str_parse = ''
str_original = 'TEXT1 TEXT2\n\nTEXT3'
label0.setText(str(str_original))
str_parse = str_original.replace(' ', '\n')
str_parse = str_parse.replace('\n\n', '\n')
label1.setText(str(str_parse)) -
Thank you for your answer. But maybe I post wrong my question. The string was not always the same, every time the space between the various text can change. So there is the possibility with some loop to format different strings that are incoming in this form:
TEXT1
TEXT2
TEXT3
Because my problem is that is the string arrive like this:
TEXT1TEXT2
etc.
I'm not able to see it in the m5 stick display. I need a sort of formatting when the string arrive before display it.Thank you and regards.
-
@fonzies83 try this commands