The wx.Accessible class allows wxWidgets applications, and wxWidgets itself, to return extended information about user interface elements to client applications such as screen readers.
This is the main way in which wxWidgets implements accessibility features.
At present, only Microsoft Active Accessibility is supported by this class.
To use this class, derive from wx.Accessible, implement appropriate functions, and associate an object of the class with a window using wx.Window.SetAccessible
.
All functions return an indication of success, failure, or not implemented using values of the AccStatus enum type.
If you return ACC_NOT_IMPLEMENTED
from any function, the system will try to implement the appropriate functionality. However this will not work with all functions.
Most functions work with an object id, which can be zero to refer to ‘this’ UI element, or greater than zero to refer to the nth child element. This allows you to specify elements that don’t have a corresponding wx.Window or wx.Accessible; for example, the sash of a splitter window.
For details on the semantics of functions and types, please refer to the Microsoft Active Accessibility 1.2 documentation.
This class is compiled into wxWidgets only if the USE_ACCESSIBILITY
setup symbol is set to 1.
Availability
Only available for MSW.
See also
Accessibility Sample
Constructor, taking an optional window. |
|
Performs the default action for the object. |
|
Gets the specified child (starting from 1). |
|
Returns the number of children in childCount. |
|
Gets the default action for this object (0) or a child (greater than 0). |
|
Returns the description for this object or a child. |
|
Gets the window with the keyboard focus. |
|
Returns help text for this object or a child, similar to tooltip text. |
|
Returns the keyboard shortcut for this object or child. |
|
Returns the rectangle for this object (id is 0) or a child element (id is greater than 0). |
|
Gets the name of the specified object. |
|
Returns the parent of this object, or |
|
Returns a role constant describing this object. |
|
Gets a variant representing the selected children of this object. |
|
Returns a state constant. |
|
Returns a localized string representing the value for the object or child. |
|
Returns the window associated with this object. |
|
Returns a status value and object id to indicate whether the given point was on this or a child object. |
|
Navigates from fromId to toId or to toObject. |
|
Allows the application to send an event when something changes in an accessible object. |
|
Selects the object or child. |
|
Sets the window associated with this object. |
wx.
Accessible
(Object)¶Possible constructors:
Accessible(win=None)
The Accessible class allows wxWidgets applications, and wxWidgets itself, to return extended information about user interface elements to client applications such as screen readers.
__init__
(self, win=None)¶Constructor, taking an optional window.
The object can be associated with a window later.
win (wx.Window) –
DoDefaultAction
(self, childId)¶Performs the default action for the object.
childId is 0 (the action for this object) or greater than 0 (the action for a child).
childId (int) –
wx.ACC_NOT_SUPPORTED
if there is no default action for this window (e.g. an edit control).
GetChild
(self, childId)¶Gets the specified child (starting from 1).
If child is None
and the return value is wx.ACC_OK
, this means that the child is a simple element and not an accessible object.
childId (int) –
tuple
( wx.AccStatus, child )
GetChildCount
(self)¶Returns the number of children in childCount.
tuple
( wx.AccStatus, childCount )
GetDefaultAction
(self, childId)¶Gets the default action for this object (0) or a child (greater than 0).
Return wx.ACC_OK
even if there is no action. actionName is the action, or the empty string if there is no action. The retrieved string describes the action that is performed on an object, not what the object does as a result. For example, a toolbar button that prints a document has a default action of “Press” rather than “Prints
the current document.”
childId (int) –
tuple
( wx.AccStatus, actionName )
GetDescription
(self, childId)¶Returns the description for this object or a child.
childId (int) –
tuple
( wx.AccStatus, description )
GetFocus
(self, childId)¶Gets the window with the keyboard focus.
If childId is 0 and child is None
, no object in this subhierarchy has the focus. If this object has the focus, child should be ‘this’.
childId (int) –
tuple
( wx.AccStatus, child )
GetHelpText
(self, childId)¶Returns help text for this object or a child, similar to tooltip text.
childId (int) –
tuple
( wx.AccStatus, helpText )
GetKeyboardShortcut
(self, childId)¶Returns the keyboard shortcut for this object or child.
Returns e.g. ALT+K
.
childId (int) –
tuple
( wx.AccStatus, shortcut )
GetLocation
(self, elementId)¶Returns the rectangle for this object (id is 0) or a child element (id is greater than 0).
rect is in screen coordinates.
elementId (int) –
tuple
( wx.AccStatus, rect )
GetName
(self, childId)¶Gets the name of the specified object.
childId (int) –
tuple
( wx.AccStatus, name )
GetParent
(self)¶Returns the parent of this object, or None
.
tuple
( wx.AccStatus, parent )
GetRole
(self, childId)¶Returns a role constant describing this object.
See AccRole for a list of these roles.
childId (int) –
tuple
( wx.AccStatus, role )
GetSelections
(self)¶Gets a variant representing the selected children of this object.
Acceptable values are:
a null variant ( IsNull()
returns True
) if no children are selected
a void*
pointer to a wx.Accessible of selected child object
an integer representing the selected child element, or 0 if this object is selected ( GetType()
==
"long"
)
a list variant ( GetType()
==
"list"
) if multiple child objects are selected
tuple
( wx.AccStatus, selections )
GetState
(self, childId)¶Returns a state constant.
See AccStatus for a list of these states.
childId (int) –
tuple
( wx.AccStatus, state )
GetValue
(self, childId)¶Returns a localized string representing the value for the object or child.
childId (int) –
tuple
( wx.AccStatus, strValue )
HitTest
(self, pt, childId, childObject)¶Returns a status value and object id to indicate whether the given point was on this or a child object.
Can return either a child object, or an integer representing the child element, starting from 1.
pt is in screen coordinates.
pt (wx.Point) –
childId (int) –
childObject (Accessible) –
Navigates from fromId to toId or to toObject.
navDir (NavDir) –
fromId (int) –
toId (int) –
toObject (Accessible) –
NotifyEvent
(eventType, window, objectType, objectId)¶Allows the application to send an event when something changes in an accessible object.
Select
(self, childId, selectFlags)¶Selects the object or child.
See AccSelectionFlags for a list of the selection actions.
childId (int) –
selectFlags (AccSelectionFlags) –
SetWindow
(self, window)¶Sets the window associated with this object.
window (wx.Window) –