Can I see an example of the get_contant_list() method?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ondesic

“Theme” has a method called get_constant_list(string type). No matter what string I put in, I get nothing back. Can some one give me an example this function in use?

:bust_in_silhouette: Reply From: njamster

Create a control node, select it in the scene tree, add a new theme in the inspector, click on it and its preview-window should open. Click on “Edit Theme” in the upper right and select “Create From Current Editor Theme”. Then attach this script:

extends Control

func _ready():
	print(self.theme.get_constant_list("Editor"))
	# should print [inspector_margin, dark_theme, scale, thumb_size]

	print(self.theme.get_constant_list("CheckBox"))
	# should print: [hseparation, check_vadjust]

njamster,
Thank you for getting me on the right direction. The theme definitely has a TextEdit and a LineEdit, however, when I code:

self.theme.get_constant_list("TextEdit")

it returns nothing.

What am I doing wrong?

ondesic | 2020-04-24 14:36

You’re not doing anything wrong: TextEdit simply does not have any constants.

njamster | 2020-04-24 18:59