Tcl 9.1/Tk9.1 Documentation > Tk Commands, version 9.1a1 > accessible

Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

NAME
accessible — Adds screenreader support for core Tk and ttk widgets.
SYNOPSIS
DESCRIPTION
INTRODUCTION
OPERATIONS
tk accessible set_acc_role window value
tk accessible set_acc_name window value
tk accessible set_acc_description window value
tk accessible set_acc_value window value
tk accessible set_acc_state window value
tk accessible set_acc_action window value
tk accessible set_acc_help window value
tk accessible get_acc_role window
tk accessible get_acc_name window
tk accessible get_acc_description window
tk accessible get_acc_value window
tk accessible get_acc_state window
tk accessible get_acc_action window
tk accessible get_acc_help window
tk accessible add_acc_object window
tk accessible emit_selection_change window
tk accessible emit_focus_change window
tk accessible check_screenreader
ADDITIONAL NOTES
KEYWORDS

NAME

accessible — Adds screenreader support for core Tk and ttk widgets.

SYNOPSIS

tk accessible set_acc_role window value
tk accessible set_acc_name window value
tk accessible set_acc_description window value
tk accessible set_acc_value window value
tk accessible set_acc_state window value
tk accessible set_acc_action window value
tk accessible set_acc_help window value
tk accessible get_acc_role window
tk accessible get_acc_name window
tk accessible get_acc_description window
tk accessible get_acc_value window
tk accessible get_acc_state window
tk accessible get_acc_action window
tk accessible get_acc_help window
tk accessible add_acc_object window
tk accessible emit_selection_change window
tk accessible emit_focus_change window
tk accessible check_screenreader

DESCRIPTION

The tk accessible command makes core Tk and ttk widgets accessible to a screen reader.

INTRODUCTION

All major computing platforms provide one or more API's to make GUI applications accessible to visually-impaired users who work using screen reader tools. Screen readers provide auditory feedback to users of a GUI application, and may provide additional or alternative methods to navigating GUI's apart from standard keyboard navigation. The tk accessible command layers a platform neutral API on top of platform-specific API's to support accessibility on Linux/Unix, macOS, and Windows.

The tk accessible command is intended to provide a basic accessible-out-of-the-box experience for end users and requires little additional work by developers. If a screen reader is in operation, Tcl/Tk applications will be accessible. The tk accessible command set does allow for additional customization on the part of developers. And widgets that are not part of the core Tk widget set can enable accessibility by using the tk accessible command set to specific the accessible role, name, description, value, state (if applicable), and action (if applicable).

OPERATIONS

The following operations are available for the tk accessible command:

tk accessible set_acc_role window value
Assigns one of the following accessibility roles to a Tk widget: Button, Canvas, Checkbutton, Combobox, Entry, Label, Listbox, Menu, Notebook, Progressbar, Scale, Scrollbar, Spinbox, Table, Text, and Tree. Tk and ttk widgets having similar roles, such as a button and a ttk::button, will both be assigned the same accessibility role as these widgets are the same from an accessibility standpoint.

tk accessible set_acc_name window value
Short label identifying the widget. Defaults to the accessibility role.

tk accessible set_acc_description window value
Longer string providing additional detail about the widget. Depending on the widget, may default to returning the widget's -text option or some similar detail.

tk accessible set_acc_value window value
Sets the widget's accessibility value. For instance, with a scale widget, will return the current numeric value of the scale.

tk accessible set_acc_state window value
Sets the widget's accessibility state, from one of the standard Tk widget states.

tk accessible set_acc_action window value
Sets the command associated with the widget, if any.

tk accessible set_acc_help window value
String providing additional information on the widget and its purpose. For instance, can provide details on specific keyboard navigation for the widget.

tk accessible get_acc_role window
Returns the widget's accessibility role.

tk accessible get_acc_name window
Returns the widget's accessibility name.

tk accessible get_acc_description window
Returns the widget's accessibility description.

tk accessible get_acc_value window
Returns the widget's accessibility value.

tk accessible get_acc_state window
Returns the widget's accessibility state.

tk accessible get_acc_action window
Returns the widget's accessibility action.

tk accessible get_acc_help window
Returns the widget's accessibility help.

tk accessible add_acc_object window
Registers the widget with the platform's accessibility API and enables accessibility for the widget.

tk accessible emit_selection_change window
Notifies the system when selection, value or other data associated with the widget changes.

tk accessible emit_focus_change window
Notifies the accessibility system when focus changes.

tk accessible check_screenreader
Checks to see if the system is running a screen reader or other accessibility process.

ADDITIONAL NOTES

Some Tk GUI components, such as frames and panedwindows, are not included in the accessibility API because they are just containers and do not handle actions or data. Also, the canvas is not included in the accessibility API because it is a purely visual widget; the HTML5 canvas widget is not accessible to web API's for the same reason. Developers may choose to provide alternative data to provide information on the canvas widget, such as labels or help text. Finally, accessibility only runs in the main Tk interpreter, because of potential conflicts in child interpreters; also, accessibility is not supported under XQuartz (the X11 environment on macOS) because of too many conflicts between the X11 and macOS versions of accessibility.

KEYWORDS

widget, tk
Copyright © 2025 Kevin Walzer