Text alignment policy for the button's text, use one of the textalign constants.
When this property is enabled, text that is too large to fit the button is clipped, when disabled the Button will always be wide enough to hold the text.
When enabled, the button's icon will expand/shrink to fit the button's size while keeping its aspect.
Flat buttons don't display decoration.
Button's icon, if text is present the icon will be placed before the text.
The button's text that will be displayed inside the button's area.
Construct a new instance of Button. Note: use memnew!Button instead.
func _ready(): var button = Button.new() button.text = "Click me" button.connect("pressed", self, "_button_pressed") add_child(button)
func _button_pressed(): print("Hello world!")
Buttons (like all Control nodes) can also be created in the editor, but some situations may require creating them from code. See also BaseButton which contains common properties and methods associated with this node. Note: Buttons do not interpret touch input and therefore don't support multitouch, since mouse emulation can only press one button at a given time. Use TouchScreenButton for buttons that trigger gameplay movement or actions, as TouchScreenButton supports multitouch.
Standard themed Button.
Button is the standard themed button. It can contain text and an icon, and will display them according to the current Theme. Example of creating a button and assigning an action when pressed by code: