texture_text#
- k3d.factory.texture_text(text: str, position: Tuple[float, float, float] = (0, 0, 0), color: int = 255, font_weight: int = 400, font_face: str = 'Courier New', font_size: int = 68, size: float = 1.0, name: str | None = None, group: str | None = None, custom_data: Dict[str, Any] | None = None, compression_level: int = 0, visible: bool = True, **kwargs: Any) TextureText[source]#
Create a TextureText drawable, a text drawn into a texture in the scene.
- Parameters:
text (str or list of str) – Content of the text.
position (list, optional) – (x, y, z) coordinates of text position, by default (0, 0, 0). If n text is pass position should contain 3*n elements . Default is (0, 0, 0).
color (int, optional) – Packed RGB color of the text (0xff0000 is red, 0xff is blue). Default is 255.
font_weight (int, optional) – Thickness of the characters in HTML-like units from the range (100, 900), where 400 is normal and 600 is bold font. Default is 400.
font_face (str, optional) – Name of the font to use for rendering the text. Default is ‘Courier New’.
font_size (int, optional) – The font size inside the sprite texture in px units. This does not affect the size of the text in the scene, only the accuracy and raster size of the texture. Default is 68.
size (float, optional) – Size of the texture sprite containing the text. Default is 1.0.
name (str, optional) – A name of the object. Default is None.
group (str, optional) – A name of a group. Default is None.
custom_data (dict, optional) – An object with custom data attached to object. Default is None.
compression_level (int, optional) – Level of compression [-1, 9]. Default is 0.
visible (bool, optional) – Whether the object is drawn. Default is True.
**kwargs – Additional keyword arguments passed to process_transform_arguments.
- Returns:
The created TextureText object.
- Return type:
TextureText
Examples#
import k3d
plt_texture_text = k3d.texture_text('Texture',
position=[0, 0, 0],
font_face='Calibri',
font_weight=600,
color=0xa2ffc8)
plot = k3d.plot()
plot += plt_texture_text
plot.display()