+1 vote

Hi guys,
I need to dynamically create a list of labels and layout them one by one vertically.
Labels will be created from JSON response from the webservice.

List will be limited up to 10 items. I know that I will have to use Label.new() but I have no clue how to implement nice vertical layout for it.

I am attaching a simple preview of what I need.
Any idea, what nodes should I use and how?

Thanks!

Layout

in Engine by (56 points)

1 Answer

+1 vote
Best answer

Make the labels children of a VBoxContainer node.

by (464 points)
selected by

Thanks! Any Idea how to style them (Change font easly on the fly?)

Two ways i know to change font and color in code.

useadd_*_override:

add_font_override("font", load("res://newfont.fnt"))
add_color_override("font_color", Color(1,0,0))

useset:

set("custom_fonts/font", load("res://newfont.fnt"))
set("custom_colors/font_color", Color(1,0,0))
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.