.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2025 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.SVGAttributes: ========================================================================================================================================== |phoenix_title| **wx.SVGAttributes** ========================================================================================================================================== Helper class for building a set of ``SVG`` and ``ARIA`` attributes to attach to an accessible group in the output of :ref:`wx.SVGFileDC`. ``ARIA`` (Accessible Rich Internet Applications) is a ``W3C`` specification of attributes that describe the content to assistive technology such as screen readers. The class exposes a chainable builder API so multiple attributes can be specified inline. The resulting object is passed to :meth:`wx.SVGFileDC.BeginAccessibleGroup` or to the `SVGAccessibleGroup` ``RAII`` helper. Example: .. versionadded:: 4.3/wxWidgets-3.3.3 | |class_hierarchy| Class Hierarchy ================================= .. raw:: html

Inheritance diagram of SVGAttributes

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.SVGAttributes.__init__` Default constructor creates an empty set of attributes. :meth:`~wx.SVGAttributes.Add` Adds or updates an arbitrary attribute. :meth:`~wx.SVGAttributes.AriaDescribedBy` Sets the ``aria-describedby`` attribute: points at the ``id`` of another element whose text content provides a longer description, announced after the accessible name. :meth:`~wx.SVGAttributes.AriaDetails` Sets the ``aria-details`` attribute: points at the ``id`` of another element containing extended information about this one (e.g., a data table describing a chart). :meth:`~wx.SVGAttributes.AriaHidden` Sets the ``aria-hidden`` attribute. :meth:`~wx.SVGAttributes.AriaLabel` Sets the ``aria-label`` attribute: a short accessible name read aloud by screen readers. :meth:`~wx.SVGAttributes.AriaLabelledBy` Sets the ``aria-labelledby`` attribute: instead of supplying a name inline, points at the ``id`` of another element whose text content provides the accessible name. :meth:`~wx.SVGAttributes.AriaRoleDescription` Sets the ``aria-roledescription`` attribute: a human-readable, optionally localized phrase that replaces the default spoken role (for example ``"pie chart"`` instead of ``"graphic"`` ). :meth:`~wx.SVGAttributes.Class` Sets the ``class`` attribute, used to associate the element with one or more CSS classes for styling the ``SVG`` output. :meth:`~wx.SVGAttributes.GetAriaDescribedBy` Returns the ``aria-describedby`` attribute. :meth:`~wx.SVGAttributes.GetAriaDetails` Returns the ``aria-details`` attribute. :meth:`~wx.SVGAttributes.GetAriaLabel` Returns the ``aria-label`` attribute. :meth:`~wx.SVGAttributes.GetAriaLabelledBy` Returns the ``aria-labelledby`` attribute. :meth:`~wx.SVGAttributes.GetAriaRoleDescription` Returns the ``aria-roledescription`` attribute. :meth:`~wx.SVGAttributes.GetAttribute` Returns the value of the attribute with the given `name`. :meth:`~wx.SVGAttributes.GetClass` Returns the ``class`` attribute. :meth:`~wx.SVGAttributes.GetId` Returns the ``id`` attribute. :meth:`~wx.SVGAttributes.GetRole` Returns the ``role`` attribute. :meth:`~wx.SVGAttributes.Id` Sets the ``id`` attribute, giving the element a unique identifier other attributes (such as ``aria-labelledby`` ) or stylesheets can reference. :meth:`~wx.SVGAttributes.IsAriaHidden` Returns ``True`` if the ``aria-hidden`` attribute is set to ``"true"`` . :meth:`~wx.SVGAttributes.IsEmpty` Returns ``True`` if no attributes have been set. :meth:`~wx.SVGAttributes.Role` Sets the ``role`` attribute, which classifies the element for assistive technology. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.SVGAttributes(object) **Possible constructors**:: SVGAttributes() -> None Helper class for building a set of ``SVG`` and ``ARIA`` attributes to attach to an accessible group in the output of SVGFileDC. .. method:: __init__(self) Default constructor creates an empty set of attributes. :rtype: `None` .. method:: Add(self, name, value) Adds or updates an arbitrary attribute. If `name` is already set, its value is replaced; otherwise a new entry is appended. :param `name`: :type `name`: string :param `value`: :type `value`: string :rtype: :ref:`wx.SVGAttributes` .. method:: AriaDescribedBy(self, id) Sets the ``aria-describedby`` attribute: points at the ``id`` of another element whose text content provides a longer description, announced after the accessible name. :param `id`: :type `id`: string :rtype: :ref:`wx.SVGAttributes` .. method:: AriaDetails(self, id) Sets the ``aria-details`` attribute: points at the ``id`` of another element containing extended information about this one (e.g., a data table describing a chart). :param `id`: :type `id`: string :rtype: :ref:`wx.SVGAttributes` .. method:: AriaHidden(self, hidden=True) Sets the ``aria-hidden`` attribute. The default `hidden` value of ``True`` is the common case (hide decorative content from assistive technology). Passing ``False`` is only meaningful when overriding an inherited ``aria-hidden="true"`` on an ancestor. :param `hidden`: :type `hidden`: bool :rtype: :ref:`wx.SVGAttributes` .. method:: AriaLabel(self, label) Sets the ``aria-label`` attribute: a short accessible name read aloud by screen readers. Use when no visible text label exists. :param `label`: :type `label`: string :rtype: :ref:`wx.SVGAttributes` .. method:: AriaLabelledBy(self, id) Sets the ``aria-labelledby`` attribute: instead of supplying a name inline, points at the ``id`` of another element whose text content provides the accessible name. :param `id`: :type `id`: string :rtype: :ref:`wx.SVGAttributes` .. method:: AriaRoleDescription(self, desc) Sets the ``aria-roledescription`` attribute: a human-readable, optionally localized phrase that replaces the default spoken role (for example ``"pie chart"`` instead of ``"graphic"`` ). :param `desc`: :type `desc`: string :rtype: :ref:`wx.SVGAttributes` .. method:: Class(self, classname) Sets the ``class`` attribute, used to associate the element with one or more CSS classes for styling the ``SVG`` output. :param `classname`: :type `classname`: string :rtype: :ref:`wx.SVGAttributes` .. method:: GetAriaDescribedBy(self) Returns the ``aria-describedby`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetAriaDetails(self) Returns the ``aria-details`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetAriaLabel(self) Returns the ``aria-label`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetAriaLabelledBy(self) Returns the ``aria-labelledby`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetAriaRoleDescription(self) Returns the ``aria-roledescription`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetAttribute(self, name) Returns the value of the attribute with the given `name`. Returns an empty string if the attribute is not set. :param `name`: :type `name`: string :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetClass(self) Returns the ``class`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetId(self) Returns the ``id`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: GetRole(self) Returns the ``role`` attribute. :rtype: `str` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: Id(self, id) Sets the ``id`` attribute, giving the element a unique identifier other attributes (such as ``aria-labelledby`` ) or stylesheets can reference. :param `id`: :type `id`: string :rtype: :ref:`wx.SVGAttributes` .. method:: IsAriaHidden(self) Returns ``True`` if the ``aria-hidden`` attribute is set to ``"true"`` . :rtype: `bool` .. versionadded:: 4.3/wxWidgets-3.3.3 .. method:: IsEmpty(self) Returns ``True`` if no attributes have been set. :rtype: `bool` .. method:: Role(self, role) Sets the ``role`` attribute, which classifies the element for assistive technology. Common ``SVG`` values include ``"img"`` (the subtree is a single graphical image), ``"graphics-document"`` , and ``"graphics-symbol"`` . :param `role`: :type `role`: string :rtype: :ref:`wx.SVGAttributes`