You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tkinter config() minor documentation bug for shorthand options #88647
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.
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')
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.
Activity
spirko commentedon Jun 21, 2021
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:
Tk().config()['bg']
Tk().config('bg')
terryjreedy commentedon Jun 26, 2021
The specific subsection link is
https://docs.python.org/3/library/tkinter.html#setting-options
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')
serhiy-storchaka commentedon Jul 11, 2026
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.gh-88647: Fix tkinter config() docs for synonym options (GH-153544)
[3.15] gh-88647: Fix tkinter config() docs for synonym options (GH-15…
[3.14] gh-88647: Fix tkinter config() docs for synonym options (GH-15…
[3.13] gh-88647: Fix tkinter config() docs for synonym options (GH-15…