[docs]classTextGraphic(Graphic):_features={"text","font_size","face_color","outline_color","outline_thickness",}def__init__(self,text:str,font_size:float|int=14,face_color:str|np.ndarray|list[float]|tuple[float]="w",outline_color:str|np.ndarray|list[float]|tuple[float]="w",outline_thickness:float=0.0,screen_space:bool=True,offset:tuple[float]=(0,0,0),anchor:str="middle-center",**kwargs,):""" Create a text Graphic Parameters ---------- text: str text to display font_size: float | int, default 10 font size face_color: str or array, default "w" str or RGBA array to set the color of the text outline_color: str or array, default "w" str or RGBA array to set the outline color of the text outline_thickness: float, default 0 relative outline thickness, value between 0.0 - 0.5 screen_space: bool = True if True, text size is in screen space, if False the text size is in data space offset: (float, float, float), default (0, 0, 0) places the text at this location anchor: str, default "middle-center" position of the origin of the text a string representing the vertical and horizontal anchors, separated by a dash * Vertical values: "top", "middle", "baseline", "bottom" * Horizontal values: "left", "center", "right" **kwargs passed to Graphic """super().__init__(**kwargs)self._text=TextData(text)self._font_size=FontSize(font_size)self._face_color=TextFaceColor(face_color)self._outline_color=TextOutlineColor(outline_color)self._outline_thickness=TextOutlineThickness(outline_thickness)world_object=pygfx.Text(text=self.text,font_size=self.font_size,screen_space=screen_space,anchor=anchor,material=pygfx.TextMaterial(color=self.face_color,outline_color=self.outline_color,outline_thickness=self.outline_thickness,pick_write=True,),)self._set_world_object(world_object)self.offset=offset@propertydefworld_object(self)->pygfx.Text:"""Text world object"""returnsuper(TextGraphic,self).world_object@propertydeftext(self)->str:"""the text displayed"""returnself._text.value@text.setterdeftext(self,text:str):self._text.set_value(self,text)@propertydeffont_size(self)->float|int:""" "text font size"""returnself._font_size.value@font_size.setterdeffont_size(self,size:float|int):self._font_size.set_value(self,size)@propertydefface_color(self)->pygfx.Color:"""text face color"""returnself._face_color.value@face_color.setterdefface_color(self,color:str|np.ndarray|list[float]|tuple[float]):self._face_color.set_value(self,color)@propertydefoutline_thickness(self)->float:"""text outline thickness"""returnself._outline_thickness.value@outline_thickness.setterdefoutline_thickness(self,thickness:float):self._outline_thickness.set_value(self,thickness)@propertydefoutline_color(self)->pygfx.Color:"""text outline color"""returnself._outline_color.value@outline_color.setterdefoutline_color(self,color:str|np.ndarray|list[float]|tuple[float]):self._outline_color.set_value(self,color)