oursin.text
Text
Functions
Clear all custom meshes |
|
Create n text objects with default parameters |
|
_summary_ |
|
_summary_ |
|
Set the positions of multiple text objects |
|
Set the string value of multiple text objects |
Classes
- class Text(text='', color=[1, 1, 1], font_size=12, position=[0, 0])[source]
Bases:
object
- 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