Button¶
Inherits: BaseButton < Control < CanvasItem < Node < Object
Inherited By: CheckBox, CheckButton, ColorPickerButton, MenuButton, OptionButton, ToolButton
Standard themed Button.
Description¶
Button is the standard themed button. It can contain text and an icon, and will display them according to the current Theme.
Properties¶
TextAlign | align | 1 |
bool | clip_text | false |
bool | expand_icon | false |
bool | flat | false |
Texture | icon | |
String | text | "" |
Theme Properties¶
StyleBox | disabled | |
StyleBox | focus | |
Font | font | |
Color | font_color | Color( 0.88, 0.88, 0.88, 1 ) |
Color | font_color_disabled | Color( 0.9, 0.9, 0.9, 0.2 ) |
Color | font_color_hover | Color( 0.94, 0.94, 0.94, 1 ) |
Color | font_color_pressed | Color( 1, 1, 1, 1 ) |
StyleBox | hover | |
int | hseparation | 2 |
StyleBox | normal | |
StyleBox | pressed |
Enumerations¶
Property Descriptions¶
- TextAlign align
Default | 1 |
Setter | set_text_align(value) |
Getter | get_text_align() |
Text alignment policy for the button’s text, use one of the TextAlign constants.
- bool clip_text
Default | false |
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.
- bool expand_icon
Default | false |
Setter | set_expand_icon(value) |
Getter | is_expand_icon() |
When enabled, the button’s icon will expand/shrink to fit the button’s size while keeping its aspect.
- bool flat
Default | false |
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
Default | "" |
Setter | set_text(value) |
Getter | get_text() |
The button’s text that will be displayed inside the button’s area.