Button

</> ursina.prefabs.button
Inherits Entity

Class Variables

.default_color

default: color.black90


.default_highlight_color

default: None


.default_model

default: Quad


.default_radius

default: 0.1


.default_texture

default: ''



Initialization

Button(     text='',     parent=camera.ui,     model=Default,     radius=Default,     origin=(0, 0),     texture=Default,     color=Default,     collider='box',     text_color=Default,     text_origin=(0, 0),     text_size=1,     highlight_text_size=None,     highlight_text_color=None,     highlight_scale=1,     pressed_scale=1,     disabled=False     )

Attributes

.radius

default: Button.default_radius if radius is Default else ra...


.model

default: Button.default_model if model is Default else mode...


.texture

default: Button.default_texture if texture is Default else ...


.color

default: Button.default_color if color is Default else colo...


.highlight_color

default: self.color.tint(0.2) if Button.default_highlight_c...


.pressed_color

default: self.color.tint(-0.2)


.highlight_scale

default: highlight_scale
multiplier


.pressed_scale

default: pressed_scale
multiplier


.highlight_sound

default: None


.pressed_sound

default: None


.highlight_text_size

default: highlight_text_size if highlight_text_size is not ...


.disabled

default: disabled
Used for temporary deactivating buttons without making them invisible, and still have collision.


.text_entity

default: None


.highlight_text_color

default: highlight_text_color if highlight_text_color is no...




Properties

text



text_origin



text_color



icon



icon_world_scale



text_size



origin



Methods

input()

input(key=None)



on_mouse_enter()

Handles color tinting, scale change, audio and Tooltip when hovering the Button




on_mouse_exit()

Handles color tinting, scale change, audio and Tooltip when unhovering the Button




fit_to_text()

fit_to_text(radius=0.1, padding=Vec2(Text.size * 1.5, Text.si...)