Tkinter Accessibility Lint Plugin
A pylint plugin that inspects tkinter usage in Python to enforce accessibility best practices.
Features
This plugin provides the following accessibility checks for tkinter applications:
- UI elements should have text attributes - Ensures that UI elements like buttons, labels, and entries have appropriate text content for screen readers
- UI controls should have tab index assignment - Verifies that interactive controls have proper tab order for keyboard navigation
Installation
pip install tkinter-a11y-lint
Or install from source:
git clone https://github.com/yourusername/tkinter-a11y-lint.git
cd tkinter-a11y-lint
pip install -e .
Usage
Command Line
Run pylint with the plugin enabled:
pylint --load-plugins=tkinter_a11y_lint.plugin your_tkinter_app.py
Configuration File
Add to your .pylintrc file:
[MASTER]
load-plugins=tkinter_a11y_lint.plugin
Error Codes
| Code | Message | Description |
|---|---|---|
| C9001 | missing-text-attribute | UI element should have text attribute for accessibility |
| C9002 | missing-tab-index | Interactive UI control should have tab index assignment |
Examples
Missing Text Attribute (C9001)
import tkinter as tk
root = tk.Tk()
# Bad: Button without text
button = tk.Button(root) # Will trigger C9001
# Good: Button with text
button = tk.Button(root, text="Click me")
Missing Tab Index (C9002)
import tkinter as tk
root = tk.Tk()
# Bad: Entry without tab index
entry = tk.Entry(root) # Will trigger C9002
# Good: Entry with tab index
entry = tk.Entry(root)
entry.configure(takefocus=True)
# or
entry = tk.Entry(root, takefocus=True)
Development
Setup Development Environment
git clone https://github.com/yourusername/tkinter-a11y-lint.git
cd tkinter-a11y-lint
pip install -e ".[dev]"
Running Tests
pytest
Code Formatting
black tkinter_a11y_lint/
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for tkinter-a11y-lint 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tkinter_a11y_lint-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / tkinter_a11y_lint-0.1.0-py3-none-any.whl
| Download URL | tkinter_a11y_lint-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7df24651e2bd5f22ac596aeee557c4676c4323ef985054c01ad1c26b54159fcb
|
|
BLAKE2b-256 checksum How to use checksums |
f11f5682c1dbe1835d6d94614fc2e7315c9e57b4dde43032da31ae95f7c1abce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|