Text
</> ursina.text
Inherits Entity
Class Variables
.size
default: 0.025
.default_font
default: 'OpenSans-Regular.ttf'
.default_monospace_font
default: 'VeraMono.ttf'
.default_resolution
default: 1080 * size * 2
.start_tag
default: '<'
.end_tag
default: '>'
Initialization
Text(text='', start_tag=start_tag, end_tag=end_tag, ignore=True)
Attributes
.size
default: Text.size
.parent
default: camera.ui
.text_nodes
default: []
.images
default: []
.origin
default: (-0.5, 0.5)
.font
default: Text.default_font
.shader
default: text_shader
.resolution
default: Text.default_resolution
default: True
.line_height
default: 1
.text_colors
default: {'default': color.text_color}
.color
default: color.text_color
.tag
default: Text.start_tag + 'default' + Text.end_tag
.current_color
default: self.text_colors['default']
.scale_override
default: 1
.appear_sequence
default: None
gets created when calling appear()
Getters
width
gets the width of the widest line.
height
gets the height of the text
lines
Properties
text
set this to update the text.
font
color
shader
line_height
resolution
wordwrap
set this to make the text wrap after a certain number of characters.
origin
background
Methods
create_text_section()
create_text_section(text=None, tag='', x=0, y=0)
align()
create_background()
create_background(padding=size * 2, radius=size, color=ursina.color.black66)
appear()
appear(speed=0.025)
make the text animate in, one character at a time
get_width()
get_width(string=None, font=None)