[issue44481] Tkinter config() minor documentation bug for shorthand options

2021-06-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

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

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, serhiy.storchaka, terry.reedy
stage:  -> needs patch
versions: +Python 3.11 -Python 3.6, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44481] Tkinter config() minor documentation bug for shorthand options

2021-06-21 Thread Jeff S


New submission from Jeff S :

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

--
components: Tkinter
messages: 396301
nosy: spirko
priority: normal
severity: normal
status: open
title: Tkinter config() minor documentation bug for shorthand options
type: behavior
versions: Python 3.6, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com