text_object
TextObject
Bases: SceneObject
Represents a text object in a 3D scene.
Attributes:
| Name | Type | Description |
|---|---|---|
actor |
vtkBillboardTextActor3D
|
The VTK actor representing the text object. |
text |
str
|
The text content of the object. |
position |
tuple
|
The position of the object in 3D space. |
font_size |
int
|
The font size of the text. |
color |
tuple
|
The color of the text. |
background_color |
tuple
|
The background color of the text. |
actor = vtkBillboardTextActor3D()
instance-attribute
background_color: tuple[int, int, int]
property
writable
Get the background color of the text.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[int, int, int]
|
The background color as a tuple of (r, g, b) values. |
bold: bool
property
writable
Get the bold property of the text.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if bold, False otherwise. |
color: tuple[int, int, int]
property
writable
Get the color of the text.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[int, int, int]
|
The color as a tuple of (r, g, b) values. |
font_size: int
property
writable
Get the font size of the text.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The font size. |
italic: bool
property
writable
Get the italic property of the text.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if italic, False otherwise. |
position: tuple[float, float, float]
property
writable
Get the position of the object in 3D space.
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[float, float, float]
|
The position as a tuple of (x, y, z) coordinates. |
text: str
property
writable
Get the text content of the object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The text content. |
__init__(font_size=12, color=(0, 0, 0))
TextObjects
Bases: SceneObject
Represents a collection of text objects in a 3D scene.
Attributes:
| Name | Type | Description |
|---|---|---|
text_objects |
list
|
A list of TextObject instances. |
actors: list
property
Get the VTK actors representing the text objects.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
A list of vtkBillboardTextActor3D instances. |
text_objects = []
instance-attribute
__init__()
add_text(text, position, color, size)
Add a new text object to the collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text |
str
|
The text content. |
required |
position |
tuple
|
The position of the object in 3D space. |
required |
color |
tuple
|
The color of the text. |
required |