oursin.text

Text

Functions

clear

Clear all custom meshes

create

Create n text objects with default parameters

set_colors

_summary_

set_font_sizes

_summary_

set_positions

Set the positions of multiple text objects

set_texts

Set the string value of multiple text objects

Classes

Text

clear()[source]

Clear all custom meshes

class Text(text='', color=[1, 1, 1], font_size=12, position=[0, 0])[source]

Bases: object

delete()[source]

Delete a text object

Examples

>>> t1.delete()
set_text(text)[source]

Set the text in a set of text objects

Parameters

textstring

text to be displayed

Examples

>>> t1.set_text('test text')
set_color(color)[source]

Set the color of a set of text objects

Parameters

colorcolor

hex code or [R,G,B]

Examples

>>> t1.set_color('#FF0000')
set_font_size(font_size)[source]

Set the font size of a set of text objects

Parameters

text_sizesint

font sizes

Examples

>>> t1.set_size(12)
set_position(position)[source]

Set the positions of a set of text objects in UI canvas space Bottom left corner is [-1,-1], top right [1,1]

Text is anchored at the top left corner of its text box.

Parameters

text_poslist of two floats

canvas positions relative to the center

Examples

>>> t1.set_position([400, 300])
create(n)[source]

Create n text objects with default parameters

Parameters

nint

number of text objects

set_texts(text_list, str_list)[source]

Set the string value of multiple text objects

Parameters

text_listlist of Text

Text objects

str_list_type_

_description_

set_positions(text_list, pos_list)[source]

Set the positions of multiple text objects

Positions are [0,1] relative to the edges of the screen

Parameters

text_listlist of Text

Text objects

pos_listlist of float

[0,0] top left [1,1] bottom right

set_font_sizes(text_list, font_size_list)[source]

_summary_

Parameters

text_listlist of Text

Text objects

font_size_list_type_

_description_

set_colors(text_list, color_list)[source]

_summary_

Parameters

text_listlist of Text

Text objects

color_list_type_

_description_