.. default-domain:: py .. highlight:: py .. currentmodule:: UI Text ==== .. class:: Text A text label. Added to a :class:`Canvas` or a :class:`Panel`. .. attribute:: rect_transform The rect transform for the UI object. :Attribute: Read-only, cannot be set :rtype: :class:`RectTransform` .. attribute:: layout_element How much space the UI object asks a layout for. :Attribute: Read-only, cannot be set :rtype: :class:`LayoutElement` .. note:: Only has an effect when the object is in a panel that has a layout. A canvas is not inside a layout and does not have one. .. attribute:: visible Whether the UI object is visible. :Attribute: Can be read or written :rtype: bool .. note:: This is the object's own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible. .. attribute:: content The text string :Attribute: Can be read or written :rtype: str .. attribute:: word_wrap Whether the text wraps onto further lines when it is wider than the space it has. Text that does not wrap carries on past the edge, and its preferred size is that of a single line, so a changing value leaves a layout in place. :Attribute: Can be read or written :rtype: bool .. attribute:: font Name of the font :Attribute: Can be read or written :rtype: str .. note:: Empty if the game provided no font to draw the text with, in which case it is not drawn. See :attr:`Text.available_fonts` for the names that can be set. .. attribute:: available_fonts A list of all available fonts. :Attribute: Read-only, cannot be set :rtype: list(str) .. attribute:: size Font size. :Attribute: Can be read or written :rtype: int .. attribute:: style Font style. :Attribute: Can be read or written :rtype: :class:`FontStyle` .. attribute:: color The color the text is drawn in. :Attribute: Can be read or written :rtype: :class:`StdLib.ColorRGBA` .. attribute:: alignment Alignment. :Attribute: Can be read or written :rtype: :class:`TextAnchor` .. attribute:: line_spacing Line spacing. :Attribute: Can be read or written :rtype: float .. method:: remove() Remove the UI object. .. class:: FontStyle Font style. .. data:: normal Normal. .. data:: bold Bold. .. data:: italic Italic. .. data:: bold_and_italic Bold and italic. .. class:: TextAlignment Text alignment. .. data:: left Left aligned. .. data:: right Right aligned. .. data:: center Center aligned. .. class:: TextAnchor Text alignment. .. data:: lower_center Lower center. .. data:: lower_left Lower left. .. data:: lower_right Lower right. .. data:: middle_center Middle center. .. data:: middle_left Middle left. .. data:: middle_right Middle right. .. data:: upper_center Upper center. .. data:: upper_left Upper left. .. data:: upper_right Upper right.