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')
|