Texture Button Text?

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

Is there a way to add text to a texture button node like the regular button node? and how can I scale a texture button node to the same scale as the vBoxContainer node?

:bust_in_silhouette: Reply From: Hinsbart

Well, TextureButtons use images instead of text, hence the name ^^
But of course you can always add a label on top of it.

I figured that would be the only way. . . maybe later it can become more like the default button node. . .

Mainman002 | 2016-02-28 21:23

:bust_in_silhouette: Reply From: Daniel Lewan

If you will be using a lot of that kind of buttons it might be good idea to create custom skin You can just change texture and font of button, no need to skin all gui controls

:bust_in_silhouette: Reply From: Kiori

To scale the button, you can try:

extends TextureButton

func _ready(): set_texture_scale(Vector2(get_rect().size.x/get_minimum_size().x, get_rect().size.y/get_minimum_size().y))

As long as the texture button is set to fill so the rect will stretch as far as the vbox.

Well that code works for me anyways…
I made an issue about this a while back, you’re welcome to chip-in.

Indeed there seems to be a minor bug (or feature) that prevents distorting the texture via manually resizing the TextureButton.

trollworkout | 2016-02-29 01:26