GeezerVison is showing github.com — `tkinter` source and docs use the word 'slave' · Issue #143754 · python/cpython
tkinter source and docs use the word 'slave' #143754
DescriptionI know tkinter is just a wrapper for Tk but this reference to slaves is pretty bad. Maybe it could be referenced as child widgets? Pretty much anything other than slaves.
Linked PRs
ActivityStanFromIreland commented on Jan 12, 2026 There are a series of occurrences both in tkinter/__init__.py and the doc. You can find suggestions for replacements in the devguide. changed the title [-]Error message references slaves[/-] [+]`tkinter` source and docs use the word 'slave'[/+] on Jan 12, 2026VanshAgarwal24036 commented on Jan 13, 2026 Hi, I’d like to work on this issue.
I understand that Tk itself uses this terminology, so my plan is to focus on:
- Updating Python-level error messages and documentation to use neutral terms
(e.g. “child widgets”, “managed widgets”).
- Renaming internal variables/comments where possible without changing the public API.
- Ensuring no behavioral changes or compatibility regressions.
I’ll start by identifying all occurrences in tkinter/init.py and the docs,
and propose consistent replacements based on the devguide.
Please let me know if this approach sounds good. i-make-data-sexy commented on Jan 13, 2026 That’s fantastic. Thank you! 👏 terryjreedy commented on Jan 14, 2026 In tk and tkinters, 'slaves' refers to the geometry managed content of a container. In tk, the place, pack, and grid commands have option 'slaves'. In tkinter/__init__.py, class Misc has corresponding place/pack/grid/_slaves methods, which refer to 'slaves' in their docstring and which call tcl with the corresponding pair of strings. (Lines 1888, 1898, 2021.)
The tcl/tk people have already dealt with this issue. Current 8.6 has a 'content' option that is a synonym for the 'slaves' option. I don't know when these were added. @serhiy-storchaka Do you have the docs or knowledge needed to find out? In 9.0, the names have been reversed, in that 'slaves' is listed as a synonym for 'content'.
We could now add 'place_content = place_slaves', etc, synonyms. There are several others to consider. Misc has 'slaves = pack_slaves', so maybe add 'content = pack_content'. Eack of class Place, Pack, and Grid have lines like slaves = pack_slaves = Misc.pack_slaves (lines 2639, 2690, 2745). So add similar for 'content'?
In docstrings, replace 'slaves' with 'contents' or perhaps 'contained widgets' or even 'placed/packed/gridded widgets'. We should not use 'children' because in tkinter, a_widget.children is a dict mapping child names to the widgets created by passing a_widget as master, the first argument, such as child = tkinter.Text(a_widget). Subsequent on-screen placement is a different issue from creation ancestry, and a child can be a content of more than one container.
Once all tkinter-supported tk versions support 'content', we could change 'slaves' to 'content' in the tcl calls.
EDIT: Docstring changes could be backported. New method names cannot, are are definitely a new feature. Reacted by Serhiy Storchaka serhiy-storchaka commented on Jan 14, 2026 I agree with @terryjreedy. The documentation part is larger, because it needs to update both docstrings and the module documentation, and we should also update the use of "master" -- in modern Tk documentation they use "container widget" in context of geometry management. "master" is also the public attribute and parameter name -- in many cases "parent" would be more correct term, but it is difficult to change API. "master" can also be used in other contexts, we should not blindly try to get rid of it. added 4 commits that reference this issue on Jan 19, 2026gh-143754: Add Tkinter methods pack_content(), place_content() and gr…
MetadataMetadataStatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|