Dynamically create and layout labels

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By desik
:warning: Old Version Published before Godot 3 was released.

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!

:bust_in_silhouette: Reply From: aozasori

Make the labels children of a VBoxContainer node.

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

desik | 2017-08-01 05:32

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

use add_*_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))

aozasori | 2017-08-01 13:56