W3cubDocs

/Godot 3.1

Button

Inherits: BaseButton < Control < CanvasItem < Node < Object

Inherited By: CheckBox, CheckButton, ColorPickerButton, MenuButton, OptionButton, ToolButton

Category: Core

Brief Description

Standard themed Button.

Properties

TextAlign align
bool clip_text
bool flat
Texture icon
String text

Theme Properties

StyleBox disabled
StyleBox focus
Font font
Color font_color
Color font_color_disabled
Color font_color_hover
Color font_color_pressed
StyleBox hover
int hseparation
StyleBox normal
StyleBox pressed

Enumerations

enum TextAlign:

  • ALIGN_LEFT = 0 — Align the text to the left.
  • ALIGN_CENTER = 1 — Align the text to the center.
  • ALIGN_RIGHT = 2 — Align the text to the right.

Description

Button is the standard themed button. It can contain text and an icon, and will display them according to the current Theme.

Property Descriptions

TextAlign align

Setter set_text_align(value)
Getter get_text_align()

Text alignment policy for the button’s text, use one of the ALIGN_* constants.

bool clip_text

Setter set_clip_text(value)
Getter get_clip_text()

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. This property is disabled by default.

bool flat

Setter set_flat(value)
Getter is_flat()

Flat buttons don’t display decoration.

Texture icon

Setter set_button_icon(value)
Getter get_button_icon()

Button’s icon, if text is present the icon will be placed before the text.

String text

Setter set_text(value)
Getter get_text()

The button’s text that will be displayed inside the button’s area.

© 2014–2019 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
http://docs.godotengine.org/en/3.1/classes/class_button.html