The LABEL component

From my observation while using the LABEL widget.
OBSERVATION: I tried print a list from a button function on a LABEL, it works and printed horizontal, but when i tried printing an iterated list, the LABEL could not display all a items in the list. Then i used a COLUMN PANEL and added the LABEL using the add_component() function and it worked properly.
SUGGESTION: It will be better to use a CONTAINER while trying to display VERTICALLY LONG TEXT in a LABEL.

YOUR SUGGESTIONS IS HIGHLY WELCOMED.

Do you have some code snippets of how you tried to add the items of text to a single label?
(I don’t think you mean print here)

I would look at the repeating panel component for displaying something like this
https://anvil.works/docs/client/components/repeating-panel

1 Like

Thanks very much. I am good.

Generally, a repeating panel will be what you want. But I’ve had a situation where I literally just want a carriage return in a label and my data is in a list. For that I use the .join() method a la:

some_list = ['a', 'b', 'c']

self.label1.text = '\n'.join(some_list)

That will give you:
a
b
c

2 Likes