Sitelet https://github.com/python/cpython/issues/88647#top
Skip to content

Tkinter config() minor documentation bug for shorthand options #88647

Description

@spirko
mannequin
BPO 44481
Nosy @terryjreedy, @serhiy-storchaka

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-06-21.23:44:11.265>
labels = ['3.11', 'type-bug', 'expert-tkinter', 'docs']
title = 'Tkinter config() minor documentation bug for shorthand options'
updated_at = <Date 2021-06-26.14:14:30.833>
user = 'https://bugs.python.org/spirko'

bugs.python.org fields:

activity = <Date 2021-06-26.14:14:30.833>
actor = 'terry.reedy'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Tkinter']
creation = <Date 2021-06-21.23:44:11.265>
creator = 'spirko'
dependencies = []
files = []
hgrepos = []
issue_num = 44481
keywords = []
message_count = 2.0
messages = ['396301', '396551']
nosy_count = 4.0
nosy_names = ['terry.reedy', 'docs@python', 'serhiy.storchaka', 'spirko']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue44481'
versions = ['Python 3.11']

Linked PRs

Activity

  1. spirko commented on Jun 21, 2021

    spirkomannequin
    MannequinAuthor

    The documentation page https://docs.python.org/3/library/tkinter.html states "Passing the config() method the name of a shorthand option will return a 2-tuple, not 5-tuple." While config() without argument does return a map that yields references like this, if config() is given the shorthand name as an argument, it follows the reference to the long option name and does yield the full 5-tuple.

    To demonstrate the difference:

    from tkinter import Tk

    Tk().config()['bg']

    Tk().config('bg')

  2. terryjreedy commented on Jun 26, 2021

    @terryjreedy
    Member

    The specific subsection link is
    https://docs.python.org/3/library/tkinter.html#setting-options

    The outputs
    >>> import tkinter as tk
    >>> r = tk.Tk()
    >>> r.config('bg')
    ('background', 'background', 'Background', <string object: 'SystemButtonFace'>, 'SystemButtonFace')
    >>> r.config()['bg']
    ('bg', '-background')

    I think
    "Example:

    >>> print(fred.config())
    {'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}

    Of course, the dictionary printed will include all the options available and their values. This is meant only as an example."

    would be clearer with ellipses instead of the sentence after a misleading output.

    "Example key-value pair in the dictionary returned by config():

    >>> fred.config()
    {..., 'relief': ('relief', 'relief', 'Relief', 'raised', 'groove'), ...}"

    The previous code should set the relieve to 'groove' in order for this to make more sense. Or, instead use example with 2- and 5-tuples.

    {..., 'fg': ('fg', '-foreground'), ..., 'foreground': ('foreground', 'foreground', 'Foreground', 'SystemButtonText', 'SystemButtonText'), ...}
    ---

    Side note: the third members of these tuples are reversed. Bug in tk?
    b.config('activebackground')
    ('activebackground', 'activeBackground', 'Foreground', 'SystemButtonFace', 'SystemButtonFace')
    b.config('activeforeground')
    ('activeforeground', 'activeForeground', 'Background', 'SystemButtonText', 'SystemButtonText')

  3. added
    docsDocumentation in the Doc dir
    3.11only security fixes
    and removed on Jun 26, 2021
  4. added
    docsDocumentation in the Doc dir
    3.11only security fixes
    and removed on Jun 26, 2021
  5. transferred this issue fromon Apr 10, 2022
  6. serhiy-storchaka commented on Jul 11, 2026

    @serhiy-storchaka
    Member

    Verified on Tk 8.6 and 9.1: passing config() a shorthand option name (e.g. bg) returns the same 5-tuple as its real option (background), not a 2-tuple — the described ('bg', 'background') behavior predates Tk 8.5. The inaccurate sentences are removed in #153544.

  7. added 4 commits that reference this issue on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesdocsDocumentation in the Doc dirtopic-tkintertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions