Accessible
- class Accessible(*args, **kwargs)
Implementations: AboutDialog
, ActionBar
, AppChooserButton
, AppChooserDialog
, AppChooserWidget
, ApplicationWindow
, AspectFrame
, Assistant
, Box
, Button
, Calendar
, CellView
, CenterBox
, CheckButton
, ColorButton
, ColorChooserDialog
, ColorChooserWidget
, ColorDialogButton
, ColumnView
, ComboBox
, ComboBoxText
, Dialog
, DragIcon
, DrawingArea
, DropDown
, EditableLabel
, EmojiChooser
, Entry
, Expander
, FileChooserDialog
, FileChooserWidget
, Fixed
, FlowBox
, FlowBoxChild
, FontButton
, FontChooserDialog
, FontChooserWidget
, FontDialogButton
, Frame
, GLArea
, GraphicsOffload
, Grid
, GridView
, HeaderBar
, IconView
, Image
, InfoBar
, Inscription
, Label
, LevelBar
, LinkButton
, ListBase
, ListBox
, ListBoxRow
, ListView
, LockButton
, MediaControls
, MenuButton
, MessageDialog
, Notebook
, Overlay
, PageSetupUnixDialog
, Paned
, PasswordEntry
, Picture
, Popover
, PopoverMenu
, PopoverMenuBar
, PrintUnixDialog
, ProgressBar
, Range
, Revealer
, Scale
, ScaleButton
, Scrollbar
, ScrolledWindow
, SearchBar
, SearchEntry
, Separator
, ShortcutLabel
, ShortcutsGroup
, ShortcutsSection
, ShortcutsShortcut
, ShortcutsWindow
, SpinButton
, Spinner
, Stack
, StackPage
, StackSidebar
, StackSwitcher
, Statusbar
, Switch
, Text
, TextView
, ToggleButton
, TreeExpander
, TreeView
, Video
, Viewport
, VolumeButton
, Widget
, Window
, WindowControls
, WindowHandle
GtkAccessible
is an interface for describing UI elements for
Assistive Technologies.
Every accessible implementation has:
a “role”, represented by a value of the
AccessibleRole
enumerationan “attribute”, represented by a set of
AccessibleState
,AccessibleProperty
andAccessibleRelation
values
The role cannot be changed after instantiating a GtkAccessible
implementation.
The attributes are updated every time a UI element’s state changes in
a way that should be reflected by assistive technologies. For instance,
if a GtkWidget
visibility changes, the HIDDEN
state will also change to reflect the visible
property.
Every accessible implementation is part of a tree of accessible objects.
Normally, this tree corresponds to the widget tree, but can be customized
by reimplementing the get_accessible_parent
,
get_first_accessible_child
and
get_next_accessible_sibling
virtual functions.
Note that you can not create a top-level accessible object as of now,
which means that you must always have a parent accessible object.
Also note that when an accessible object does not correspond to a widget,
and it has children, whose implementation you don’t control,
it is necessary to ensure the correct shape of the a11y tree
by calling set_accessible_parent
and
updating the sibling by update_next_accessible_sibling
.
Methods
- class Accessible
- announce(message: str, priority: AccessibleAnnouncementPriority) None
Requests the user’s screen reader to announce the given message.
This kind of notification is useful for messages that either have only a visual representation or that are not exposed visually at all, e.g. a notification about a successful operation.
Also, by using this API, you can ensure that the message does not interrupts the user’s current screen reader output.
Added in version 4.14.
- Parameters:
message – the string to announce
priority – the priority of the announcement
- get_accessible_parent() Accessible | None
Retrieves the accessible parent for an accessible object.
This function returns
NULL
for top level widgets.Added in version 4.10.
- get_accessible_role() AccessibleRole
Retrieves the accessible role of an accessible object.
- get_at_context() ATContext
Retrieves the accessible implementation for the given
GtkAccessible
.Added in version 4.10.
- get_bounds() tuple[bool, int, int, int, int]
Queries the coordinates and dimensions of this accessible
This functionality can be overridden by
GtkAccessible
implementations, e.g. to get the bounds from an ignored child widget.Added in version 4.10.
- get_first_accessible_child() Accessible | None
Retrieves the first accessible child of an accessible object.
Added in version 4.10.
- get_next_accessible_sibling() Accessible | None
Retrieves the next accessible sibling of an accessible object
Added in version 4.10.
- get_platform_state(state: AccessiblePlatformState) bool
Query a platform state, such as focus.
See gtk_accessible_platform_changed().
This functionality can be overridden by
GtkAccessible
implementations, e.g. to get platform state from an ignored child widget, as is the case forGtkText
wrappers.Added in version 4.10.
- Parameters:
state – platform state to query
- reset_property(property: AccessibleProperty) None
Resets the accessible
property
to its default value.- Parameters:
property – a
GtkAccessibleProperty
- reset_relation(relation: AccessibleRelation) None
Resets the accessible
relation
to its default value.- Parameters:
relation – a
GtkAccessibleRelation
- reset_state(state: AccessibleState) None
Resets the accessible
state
to its default value.- Parameters:
state – a
GtkAccessibleState
- set_accessible_parent(parent: Accessible | None = None, next_sibling: Accessible | None = None) None
Sets the parent and sibling of an accessible object.
This function is meant to be used by accessible implementations that are not part of the widget hierarchy, and but act as a logical bridge between widgets. For instance, if a widget creates an object that holds metadata for each child, and you want that object to implement the
GtkAccessible
interface, you will use this function to ensure that the parent of each child widget is the metadata object, and the parent of each metadata object is the container widget.Added in version 4.10.
- Parameters:
parent – the parent accessible object
next_sibling – the sibling accessible object
- update_next_accessible_sibling(new_sibling: Accessible | None = None) None
Updates the next accessible sibling of
self
.That might be useful when a new child of a custom
GtkAccessible
is created, and it needs to be linked to a previous child.Added in version 4.10.
- Parameters:
new_sibling – the new next accessible sibling to set
- update_property(properties: Sequence[AccessibleProperty], values: Sequence[Any]) None
Updates a list of accessible properties.
See the
AccessibleProperty
documentation for the value types of accessible properties.This function should be called by
GtkWidget
types whenever an accessible property change must be communicated to assistive technologies.Example:
value = gtk_adjustment_get_value (adjustment); gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, -1);
- Parameters:
properties
values
- update_relation(relations: Sequence[AccessibleRelation], values: Sequence[Any]) None
Updates a list of accessible relations.
This function should be called by
GtkWidget
types whenever an accessible relation change must be communicated to assistive technologies.If the
AccessibleRelation
requires a list of references, you should pass each reference individually, followed byNone
, e.g.gtk_accessible_update_relation (accessible, GTK_ACCESSIBLE_RELATION_CONTROLS, ref1, NULL, GTK_ACCESSIBLE_RELATION_LABELLED_BY, ref1, ref2, ref3, NULL, -1);
- Parameters:
relations
values
- update_state(states: Sequence[AccessibleState], values: Sequence[Any]) None
Updates a list of accessible states. See the
AccessibleState
documentation for the value types of accessible states.This function should be called by
GtkWidget
types whenever an accessible state change must be communicated to assistive technologies.Example:
value = GTK_ACCESSIBLE_TRISTATE_MIXED; gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), GTK_ACCESSIBLE_STATE_CHECKED, value, -1);
- Parameters:
states
values
Properties
- class Accessible
- props.accessible_role: AccessibleRole
The accessible role of the given
GtkAccessible
implementation.The accessible role cannot be changed once set.
Virtual Methods
- class Accessible
- do_get_accessible_parent() Accessible | None
Retrieves the accessible parent for an accessible object.
This function returns
NULL
for top level widgets.Added in version 4.10.
- do_get_at_context() ATContext | None
Retrieves the accessible implementation for the given
GtkAccessible
.Added in version 4.10.
- do_get_bounds() tuple[bool, int, int, int, int]
Queries the coordinates and dimensions of this accessible
This functionality can be overridden by
GtkAccessible
implementations, e.g. to get the bounds from an ignored child widget.Added in version 4.10.
- do_get_first_accessible_child() Accessible | None
Retrieves the first accessible child of an accessible object.
Added in version 4.10.
- do_get_next_accessible_sibling() Accessible | None
Retrieves the next accessible sibling of an accessible object
Added in version 4.10.
- do_get_platform_state(state: AccessiblePlatformState) bool
Query a platform state, such as focus.
See gtk_accessible_platform_changed().
This functionality can be overridden by
GtkAccessible
implementations, e.g. to get platform state from an ignored child widget, as is the case forGtkText
wrappers.Added in version 4.10.
- Parameters:
state – platform state to query