oursin.text

Text

Functions

create

Create a text object

delete

Delete a text object

set_color

Set the color of a set of text objects

set_position

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

set_size

Set the font size of a set of text objects

set_text

Set the text in a set of text objects

create(text_id)[source]

Create a text object

Parameters

text_idlist of strings

IDs for text objects

>>> urn.create(['t1','t2'])
delete(text_id)[source]

Delete a text object

Parameters

text_idlist of strings

IDs for text objects

>>> urn.delete(['t1'])
set_text(text_text)[source]

Set the text in a set of text objects

Parameters

text_textdict {stringstring}

dictionary of IDs and text

>>> urn.set_text({'t1': 'test text'})
set_color(text_colors)[source]

Set the color of a set of text objects

Parameters

text_colorsdict {stringstring hex color}

dictionary of IDs and hex colors as strings

>>> urn.set_color({'t1': '#FF0000'})
set_size(text_sizes)[source]

Set the font size of a set of text objects

Parameters

text_sizesdict {stringint}

dictionary of IDs and font sizes

>>> urn.set_size({'t1': 12})
set_position(text_pos)[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_posdict {stringlist of two floats}

dictionary of IDs and canvas positions relative to the center

>>> urn.set_position({'t1': [400, 300]})