for performance reason,
some of properties are not updated immediately.
extends Label
func _ready():
text = "test string"
printt("size =", rect_size) # (40,14)
it's just default size of Label
you can get the actual size of Label in several ways.
Wait for 1 frame
extends Label
func _ready():
text = "test string"
yield(get_tree(), "idle_frame")
printt("size =", rect_size) # (65, 14)
Force to get size
extends Label
func _ready():
text = "test string"
printt("size =", get_combined_minimum_size()) # (65, 14)
Get size with signal
extends Label
func _ready():
connect("item_rect_changed", self, "on_item_rect_changed")
text = "test string"
func on_item_rect_changed():
printt("size =", rect_size) # (65,14)