Skip to content

gh-145578: Add tkinter support for the Tk 9.1 accessibility API (flat methods)#153246

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-145578-tk-accessible
Open

gh-145578: Add tkinter support for the Tk 9.1 accessibility API (flat methods)#153246
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-145578-tk-accessible

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 7, 2026

Copy link
Copy Markdown
Member

Tk 9.1 added the tk accessible command, which exposes widgets to assistive technologies such as screen readers.

Add widget methods mirroring the Tk subcommand names in the style of tk_busy_*: tk_set_acc_*/tk_get_acc_* pairs for the role, name, description, value, state, action and help attributes exposed to assistive technologies, the tk_add_acc_object(), tk_emit_selection_change() and tk_emit_focus_change() methods which register custom widgets with the platform accessibility API, and tk_check_screenreader() which reports whether a screen reader is running.

entry.tk_set_acc_name('User name')

If no assistive technology is active when the application starts, the setters have no effect and the getters return 0. Reading an attribute that has never been set raises TclError.

The test requires Tk 9.1 with accessibility support compiled in (ATK on X11) and skips otherwise. Verified against Tk 9.1b1 built with ATK, with and without Orca running.

Alternative design with an Accessible object: #153247. Only one of the two should be merged.

Add the tk_set_acc_* and tk_get_acc_* families of methods which set
and return the accessible attributes of a widget, the
tk_add_acc_object(), tk_emit_selection_change() and
tk_emit_focus_change() methods which register custom widgets with the
platform accessibility API, and the tk_check_screenreader() method
which reports whether a screen reader is running.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33473495 | 📁 Comparing 64f444c against main (35c6779)

  🔍 Preview build  

3 files changed
± library/tkinter.html
± whatsnew/3.16.html
± whatsnew/changelog.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant