Actor > Text

Actor > Text#

class miniworlds.actors.texts.text.Text(position=(0, 0), text='', **kwargs)[source]

A Text-Actor is a actor which contains a Text.

You have to set the size of the actor with self.size() manually so that the complete text can be seen.

Parameters:
  • position – Top-Left position of Text.

  • text – The initial text

Examples

Create a new texts:

self.text = TextActor((1,1), "Hello World")
__init__(position=(0, 0), text='', **kwargs)[source]

_summary_

Parameters:
  • position (tuple, optional) – _description_. Defaults to (0,0).

  • text (Optional[int]) – The text (otherwise empty string “”)

font_by_size(width=None, height=None)[source]
property font_size

Set font size to a value, e.g. 10, 12, …

Examples:

Sets size of actor to 10:

text.font_size = 10
get_text()[source]

Gets the currently displayed text

Returns:

The currently displayed text

get_text_width()[source]
property max_width
new_costume()[source]
on_shape_change()[source]
set_text(text)[source]

Sets the text of the actor

Parameters:

text – The text

property text

changes the text.