phoenix_title wx.Accessible

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


class_hierarchy Class Hierarchy

Inheritance diagram for class Accessible:

method_summary Methods Summary

__init__

Constructor, taking an optional window.

DoDefaultAction

Performs the default action for the object.

GetChild

Gets the specified child (starting from 1).

GetChildCount

Returns the number of children in childCount.

GetDefaultAction

Gets the default action for this object (0) or a child (greater than 0).

GetDescription

Returns the description for this object or a child.

GetFocus

Gets the window with the keyboard focus.

GetHelpText

Returns help text for this object or a child, similar to tooltip text.

GetKeyboardShortcut

Returns the keyboard shortcut for this object or child.

GetLocation

Returns the rectangle for this object (id is 0) or a child element (id is greater than 0).

GetName

Gets the name of the specified object.

GetParent

Returns the parent of this object, or None.

GetRole

Returns a role constant describing this object.

GetSelections

Gets a variant representing the selected children of this object.

GetState

Returns a state constant.

GetValue

Returns a localized string representing the value for the object or child.

GetWindow

Returns the window associated with this object.

HitTest

Returns a status value and object id to indicate whether the given point was on this or a child object.

Navigate

Navigates from fromId to toId or to toObject.

NotifyEvent

Allows the application to send an event when something changes in an accessible object.

Select

Selects the object or child.

SetWindow

Sets the window associated with this object.


property_summary Properties Summary

Window

See GetWindow and SetWindow


api Class API

class 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.


Methods

__init__(self, win=None)

Constructor, taking an optional window.

The object can be associated with a window later.

Parameters:

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).

Parameters:

childId (int) –

Return type:

wx.AccStatus

Returns:

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.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, child )



GetChildCount(self)

Returns the number of children in childCount.

Return type:

tuple

Returns:

( 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.”

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, actionName )



GetDescription(self, childId)

Returns the description for this object or a child.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( 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’.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, child )



GetHelpText(self, childId)

Returns help text for this object or a child, similar to tooltip text.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, helpText )



GetKeyboardShortcut(self, childId)

Returns the keyboard shortcut for this object or child.

Returns e.g. ALT+K.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( 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.

Parameters:

elementId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, rect )



GetName(self, childId)

Gets the name of the specified object.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, name )



GetParent(self)

Returns the parent of this object, or None.

Return type:

tuple

Returns:

( wx.AccStatus, parent )



GetRole(self, childId)

Returns a role constant describing this object.

See AccRole for a list of these roles.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( 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

Return type:

tuple

Returns:

( wx.AccStatus, selections )



GetState(self, childId)

Returns a state constant.

See AccStatus for a list of these states.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, state )



GetValue(self, childId)

Returns a localized string representing the value for the object or child.

Parameters:

childId (int) –

Return type:

tuple

Returns:

( wx.AccStatus, strValue )



GetWindow(self)

Returns the window associated with this object.

Return type:

wx.Window



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.

Parameters:
Return type:

wx.AccStatus



Navigate(self, navDir, fromId, toId, toObject)

Navigates from fromId to toId or to toObject.

Parameters:
Return type:

wx.AccStatus



static NotifyEvent(eventType, window, objectType, objectId)

Allows the application to send an event when something changes in an accessible object.

Parameters:
  • eventType (int) –

  • window (wx.Window) –

  • objectType (AccObject) –

  • objectId (int) –



Select(self, childId, selectFlags)

Selects the object or child.

See AccSelectionFlags for a list of the selection actions.

Parameters:
Return type:

wx.AccStatus



SetWindow(self, window)

Sets the window associated with this object.

Parameters:

window (wx.Window) –


Properties

Window

See GetWindow and SetWindow