Skip to content

Commit b579cb7

Browse files
Merge branch 'main' into clear_NameError_suggestion
2 parents 6e895a8 + ff0a9ae commit b579cb7

14 files changed

Lines changed: 55 additions & 35 deletions

Doc/library/dialog.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,16 @@ string, an empty tuple, an empty list or ``None``.
209209

210210
.. class:: Open(master=None, **options)
211211
SaveAs(master=None, **options)
212+
Directory(master=None, **options)
212213
213-
The above two classes provide native dialog windows for saving and loading
214-
files.
214+
The above three classes provide native dialog windows for loading and saving
215+
files and for selecting a directory.
215216

216217
**Convenience classes**
217218

218219
The below classes are used for creating file/directory windows from scratch.
219220
These do not emulate the native look-and-feel of the platform.
220221

221-
.. class:: Directory(master=None, **options)
222-
223-
Create a dialog prompting the user to select a directory.
224-
225222
.. note:: The *FileDialog* class should be subclassed for custom event
226223
handling and behaviour.
227224

@@ -361,23 +358,25 @@ the classic (non-themed) Tk widgets.
361358

362359
.. data:: DIALOG_ICON
363360

364-
The name of the default bitmap (``'questhead'``) displayed by a
365-
:class:`Dialog`.
361+
The name of a bitmap (``'questhead'``) suitable for use as the *bitmap*
362+
of a :class:`Dialog`.
366363

367364
.. class:: Dialog(master=None, cnf={}, **kw)
368365

369366
Display a modal dialog box built from the classic (non-themed) Tk widgets
370367
and wait for the user to press one of its buttons.
371-
The options, given through *cnf* or as keyword arguments, include *title*
372-
(the window title), *text* (the message), *bitmap* (an icon,
373-
:data:`DIALOG_ICON` by default), *default* (the index of the default button)
374-
and *strings* (the sequence of button labels).
368+
The options, given through *cnf* or as keyword arguments, are all required:
369+
*title* (the window title), *text* (the message), *bitmap* (the name of a
370+
bitmap icon, such as :data:`DIALOG_ICON`), *default* (the index of the
371+
default button) and *strings* (the sequence of button labels).
375372
After construction, the :attr:`!num` attribute holds the index of the button
376373
the user pressed.
377374

378375
.. method:: destroy()
379376

380-
Destroy the dialog window.
377+
Do nothing.
378+
The dialog window is destroyed automatically before the constructor
379+
returns, so there is nothing left for this method to do.
381380

382381

383382
.. seealso::

Doc/library/tkinter.messagebox.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ a variety of convenience methods for commonly used configurations.
1313
The message boxes are modal: each blocks until the user responds, then returns
1414
a value that depends on the function.
1515
The ``show*`` functions and :meth:`Message.show` return the symbolic name of
16-
the button the user pressed, as a string (such as :data:`OK` or :data:`YES`),
17-
while the ``ask*`` functions return a :class:`bool` or ``None`` (see each
18-
function below).
16+
the button the user pressed, as a string (such as :data:`OK` or :data:`YES`).
1917
Common message box styles and layouts include but are not limited to:
2018

2119
.. figure:: tk_msg.png

Doc/library/tkinter.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,8 +2356,8 @@ Base and mixin classes
23562356
If all four arguments are given, the window manager keeps the ratio
23572357
between ``minNumer/minDenom`` and ``maxNumer/maxDenom``; passing empty
23582358
strings removes any existing restriction.
2359-
With no arguments, return a tuple of the four current values, or an empty
2360-
string if no aspect restriction is in effect.
2359+
With no arguments, return a tuple of the four current values, or ``None``
2360+
if no aspect restriction is in effect.
23612361
:meth:`wm_aspect` is an alias of :meth:`!aspect`.
23622362

23632363
.. method:: wm_attributes(*args, return_python_dict=False, **kwargs)
@@ -2582,8 +2582,8 @@ Base and mixin classes
25822582
window's internally requested size, and *widthInc* and *heightInc* are
25832583
the pixel sizes of a horizontal and vertical grid unit.
25842584
Empty strings turn off gridded management.
2585-
With no arguments, return a tuple of the four current values, or an empty
2586-
string if the window is not gridded.
2585+
With no arguments, return a tuple of the four current values, or ``None``
2586+
if the window is not gridded.
25872587
:meth:`wm_grid` is an alias of :meth:`!grid`.
25882588

25892589
Not to be confused with the grid geometry manager :meth:`Grid.grid`.
@@ -2696,8 +2696,8 @@ Base and mixin classes
26962696
Set or query a hint to the window manager about where the window's icon
26972697
should be positioned.
26982698
Empty strings cancel an existing hint.
2699-
With no arguments, return a tuple of the two current values, or an empty
2700-
string if no hint is in effect.
2699+
With no arguments, return a tuple of the two current values, or ``None``
2700+
if no hint is in effect.
27012701
:meth:`wm_iconposition` is an alias of :meth:`!iconposition`.
27022702

27032703
.. method:: wm_iconwindow(pathName=None)
@@ -2766,7 +2766,8 @@ Base and mixin classes
27662766
When this flag is set, the window is ignored by the window manager: it is
27672767
not reparented into a decorative frame and the user cannot manipulate it
27682768
through the usual window manager controls.
2769-
With no argument, return a boolean indicating whether the flag is set.
2769+
With no argument, return a boolean indicating whether the flag is set,
2770+
or ``None`` if it has not been set.
27702771
The flag is reliably honored only when the window is first mapped or
27712772
remapped from the withdrawn state.
27722773
:meth:`wm_overrideredirect` is an alias of :meth:`!overrideredirect`.

Doc/library/tkinter.ttk.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ To override the basic Tk widgets, the import should follow the Tk import::
4242

4343
That code causes several :mod:`!tkinter.ttk` widgets (:class:`Button`,
4444
:class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`,
45-
:class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`,
46-
:class:`Radiobutton`, :class:`Scale` and :class:`Scrollbar`) to
45+
:class:`LabelFrame`, :class:`Menubutton`, :class:`OptionMenu`,
46+
:class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`,
47+
:class:`Scrollbar` and :class:`Spinbox`) to
4748
automatically replace the Tk widgets.
4849

4950
This has the direct benefit of using the new widgets which gives a better look
@@ -1039,6 +1040,9 @@ ttk.Treeview
10391040
The minimum width of the column in pixels. The treeview widget will
10401041
not make the column any smaller than specified by this option when
10411042
the widget is resized or the user drags a column.
1043+
*separator*: ``True``/``False``
1044+
Specifies whether a column separator should be drawn to the right of
1045+
the column.
10421046
*stretch*: ``True``/``False``
10431047
Specifies whether the column's width should be adjusted when
10441048
the widget is resized.
@@ -2167,8 +2171,11 @@ and inherits the common methods of :class:`Widget`.
21672171
display in the menu.
21682172
A *command* keyword argument may be given to specify a callable that is
21692173
invoked with the selected value whenever the selection changes; the *style*
2170-
keyword argument sets the style used by the underlying menubutton; and the
2171-
*name* keyword argument sets the Tk widget name.
2174+
keyword argument sets the style used by the underlying menubutton; the
2175+
*direction* keyword argument sets where the menu is posted relative to the
2176+
menubutton (one of ``'above'``, ``'below'`` (the default), ``'left'``,
2177+
``'right'`` or ``'flush'``); and the *name* keyword argument sets the Tk
2178+
widget name.
21722179

21732180
.. method:: set_menu(default=None, *values)
21742181

Lib/tkinter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Tkinter provides classes which allow the display, positioning and
44
control of widgets. Toplevel widgets are Tk and Toplevel. Other
55
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
6-
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
6+
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox,
77
LabelFrame and PanedWindow.
88
99
Properties of the widgets are specified with keyword arguments.
@@ -2528,7 +2528,7 @@ def wm_iconphoto(self, default=False, *args): # new in Tk 8.5
25282528

25292529
def wm_iconposition(self, x=None, y=None):
25302530
"""Set the position of the icon of this widget to X and Y. Return
2531-
a tuple of the current values of X and X if None is given."""
2531+
a tuple of the current values of X and Y if None is given."""
25322532
return self._getints(self.tk.call(
25332533
'wm', 'iconposition', self._w, x, y))
25342534

Lib/tkinter/colorchooser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Interface to the native Tk color selection dialog."""
2+
13
# tk common color chooser dialogue
24
#
35
# this module provides an interface to the native color dialogue

Lib/tkinter/commondialog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Base class for the Tk common dialogs."""
2+
13
# base class for tk common dialogues
24
#
35
# this module provides a base class for accessing the common

Lib/tkinter/dialog.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# dialog.py -- Tkinter interface to the tk_dialog script.
22

3+
"""Classic Tk dialog box, wrapping the tk_dialog script."""
4+
35
from tkinter import _cnfmerge, Widget, TclError, Button, Pack
46

57
__all__ = ["Dialog"]
@@ -8,6 +10,8 @@
810

911

1012
class Dialog(Widget):
13+
"""A modal dialog box built from the classic (non-themed) Tk widgets."""
14+
1115
def __init__(self, master=None, cnf={}, **kw):
1216
cnf = _cnfmerge((cnf, kw))
1317
self.widgetName = '__dialog__'
@@ -21,7 +25,8 @@ def __init__(self, master=None, cnf={}, **kw):
2125
try: Widget.destroy(self)
2226
except TclError: pass
2327

24-
def destroy(self): pass
28+
def destroy(self):
29+
"""Do nothing; the dialog window is already destroyed."""
2530

2631

2732
def _test():

Lib/tkinter/font.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Utilities to help work with fonts in Tkinter."""
2+
13
# Tkinter font wrapper
24
#
35
# written by Fredrik Lundh, February 1998

Lib/tkinter/messagebox.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Interface to the standard Tk message boxes."""
2+
13
# tk common message boxes
24
#
35
# this module provides an interface to the native message boxes

0 commit comments

Comments
 (0)