Repository navigation
Tkinter config() minor documentation bug for shorthand options #88647
Description
Activity
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')
- added3.9 (EOL)end of lifeend of lifetype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jun 21, 2021 The specific subsection link is
https://docs.python.org/3/library/tkinter.html#setting-optionsThe 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')- addeddocsDocumentation in the Doc dirDocumentation in the Doc dir3.11only security fixesonly security fixesand removed3.9 (EOL)end of lifeend of life
on Jun 26, 2021 - addeddocsDocumentation in the Doc dirDocumentation in the Doc dir3.11only security fixesonly security fixesand removed3.9 (EOL)end of lifeend of life
on Jun 26, 2021 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.- added 4 commits that reference this issue
on Jul 11, 2026
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:
bugs.python.org fields:
Linked PRs