Button

</> ursina.prefabs.button
Inherits Entity

Class Variables

.default_color

default: color.black90


.default_highlight_color

default: None


.default_model

default: None
will default to rounded Quad



Initialization

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

Attributes

.highlight_color

default: self.color.tint(0.2) if __class__.default_highligh...


.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


.disabled

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


.text_entity

default: None


.model

default: Button.default_model


.model

default: Quad(aspect=self.scale[0] / self.scale[1], radius=...




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...)