UI Text
Text
Text(
scene: "Scene",
parent: Element,
*,
text: str,
color: ColorRGBA,
font: pygame.font.Font,
position: tuple[Union[int, float], Union[int, float]],
anchor: Anchor = Anchor.TOP_LEFT
)
Bases: Element
User-Interface Text.
Create a new user interface text.
| PARAMETER | DESCRIPTION |
|---|---|
scene
|
The scene to interface this instance with.
TYPE:
|
parent
|
Any
TYPE:
|
text
|
The text that will be shown.
TYPE:
|
color
|
The color of the foreground (text).
TYPE:
|
font
|
The font to render the text as. |
position
|
TYPE:
|
anchor
|
The chosen area of this element to place at the position provided. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
|
ValueError
|
|
text_render
instance-attribute
Rendered internal text object that is updated every change - Usable with OpenGL as well.
set_font
set_transform
set_transform(
*,
anchor: Anchor = None,
position: tuple[
Union[int, float], Union[int, float]
] = None
) -> None
Set the transform (position, size, anchor) attributes of this element.
| PARAMETER | DESCRIPTION |
|---|---|
anchor
|
If provided, change the anchor point of this element.
TYPE:
|
position
|
If provided, change the position of this element - |
Info
anchor, position, or size are optional, but one has to be specified.
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
|
ValueError
|
|
tween
tween(
position: Iterable[Union[int, float]],
duration: float,
easing: Callable[[float], float] = Easing.LINEAR,
) -> None
Tween/animate this element to an end state over a period of time.
| PARAMETER | DESCRIPTION |
|---|---|
position
|
The end position to reach. |
duration
|
The time in which it'll take to animate this element in seconds.
TYPE:
|
easing
|
The easing function to use when animating.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
|
ValueError
|
|
add_child
add_child(child: Element) -> None
remove_child
remove_child(child: Element) -> None
render_opengl
render_opengl() -> None
Forceably render this element to the screen using a custom-implemented OpenGL rendering program.
request_render
request_render() -> None
Render this element and it's children to the screen, if enabled.
set_tween_callback
set_tween_callback(
callback: Callable[[None], None],
) -> None
Set a callback method for when this element finishes tweening/animating.