Skip to content

SemanticsService

SemanticsService #

Bases: Service

Allows access to the platform's accessibility services.

data #

data: Any = skip_field()

Arbitrary data of any type.

key #

key: (
    str | int | float | bool | ValueKey | ScrollKey | None
) = None

page #

page: Page | PageView | None

The page (of type Page or PageView) to which this control belongs to.

parent #

parent: BaseControl | None

The direct ancestor(parent) of this control.

It defaults to None and will only have a value when this control is mounted (added to the page tree).

The Page control (which is the root of the tree) is an exception - it always has parent=None.

announce_message #

announce_message(
    message: str,
    rtl: bool = False,
    assertiveness: Assertiveness = POLITE,
)

Sends a semantic announcement with the given message. This should preferably be used for announcements that are not seamlessly announced by the system as a result of a UI state change.

rtl is a boolean and indicates the text direction of the message.

The assertiveness level of the announcement is only supported by the web engine and has no effect on other platforms. Value is an Assertiveness enum and can either be Assertiveness.ASSERTIVE or Assertiveness.POLITE (default).

announce_message_async #

announce_message_async(
    message: str,
    rtl: bool = False,
    assertiveness: Assertiveness = POLITE,
)

Sends a semantic announcement with the given message. This should preferably be used for announcements that are not seamlessly announced by the system as a result of a UI state change.

rtl is a boolean and indicates the text direction of the message.

The assertiveness level of the announcement is only supported by the web engine and has no effect on other platforms. Value is an Assertiveness enum and can either be Assertiveness.ASSERTIVE or Assertiveness.POLITE (default).

announce_tooltip #

announce_tooltip(message: str)

Sends a semantic announcement of a tooltip. Currently honored on Android only.

The provided message will be read by TalkBack.

announce_tooltip_async #

announce_tooltip_async(message: str)

Sends a semantic announcement of a tooltip. Currently honored on Android only.

The provided message will be read by TalkBack.

before_event #

before_event(e: ControlEvent)

before_update #

before_update()

This method is called every time when this control is being updated.

Note

Make sure not to call/request an update() here.

did_mount #

did_mount()

init #

init()

is_isolated #

is_isolated()

update #

update() -> None

will_unmount #

will_unmount()