gh-101100: Fix Sphinx warnings in `turtle` module (GH-102340)

(cherry picked from commit 78e4e6c3d7)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
Miss Islington (bot) 2023-03-13 04:11:34 -07:00 committed by GitHub
parent 5bdcb08250
commit a01ad527e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 28 deletions

View File

@ -1214,7 +1214,7 @@ Appearance
will be displayed stretched according to its stretchfactors: *stretch_wid* is will be displayed stretched according to its stretchfactors: *stretch_wid* is
stretchfactor perpendicular to its orientation, *stretch_len* is stretchfactor perpendicular to its orientation, *stretch_len* is
stretchfactor in direction of its orientation, *outline* determines the width stretchfactor in direction of its orientation, *outline* determines the width
of the shapes's outline. of the shape's outline.
.. doctest:: .. doctest::
:skipif: _tkinter is None :skipif: _tkinter is None
@ -1545,7 +1545,7 @@ below:
1. Create an empty Shape object of type "compound". 1. Create an empty Shape object of type "compound".
2. Add as many components to this object as desired, using the 2. Add as many components to this object as desired, using the
:meth:`addcomponent` method. :meth:`~Shape.addcomponent` method.
For example: For example:
@ -2125,7 +2125,7 @@ Public classes
:param cv: a :class:`tkinter.Canvas` :param cv: a :class:`tkinter.Canvas`
Provides screen oriented methods like :func:`setbg` etc. that are described Provides screen oriented methods like :func:`bgcolor` etc. that are described
above. above.
.. class:: Screen() .. class:: Screen()
@ -2315,7 +2315,9 @@ of this module or which better fits to your needs, e.g. for use in a classroom,
you can prepare a configuration file ``turtle.cfg`` which will be read at import you can prepare a configuration file ``turtle.cfg`` which will be read at import
time and modify the configuration according to its settings. time and modify the configuration according to its settings.
The built in configuration would correspond to the following turtle.cfg:: The built in configuration would correspond to the following ``turtle.cfg``:
.. code-block:: ini
width = 0.5 width = 0.5
height = 0.75 height = 0.75
@ -2340,15 +2342,15 @@ The built in configuration would correspond to the following turtle.cfg::
Short explanation of selected entries: Short explanation of selected entries:
- The first four lines correspond to the arguments of the :meth:`Screen.setup` - The first four lines correspond to the arguments of the :func:`Screen.setup <setup>`
method. method.
- Line 5 and 6 correspond to the arguments of the method - Line 5 and 6 correspond to the arguments of the method
:meth:`Screen.screensize`. :func:`Screen.screensize <screensize>`.
- *shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For more - *shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For more
info try ``help(shape)``. info try ``help(shape)``.
- If you want to use no fillcolor (i.e. make the turtle transparent), you have - If you want to use no fill color (i.e. make the turtle transparent), you have
to write ``fillcolor = ""`` (but all nonempty strings must not have quotes in to write ``fillcolor = ""`` (but all nonempty strings must not have quotes in
the cfg-file). the cfg file).
- If you want to reflect the turtle its state, you have to use ``resizemode = - If you want to reflect the turtle its state, you have to use ``resizemode =
auto``. auto``.
- If you set e.g. ``language = italian`` the docstringdict - If you set e.g. ``language = italian`` the docstringdict
@ -2398,6 +2400,8 @@ The :mod:`turtledemo` package directory contains:
The demo scripts are: The demo scripts are:
.. currentmodule:: turtle
.. tabularcolumns:: |l|L|L| .. tabularcolumns:: |l|L|L|
+----------------+------------------------------+-----------------------+ +----------------+------------------------------+-----------------------+
@ -2469,20 +2473,20 @@ Have fun!
Changes since Python 2.6 Changes since Python 2.6
======================== ========================
- The methods :meth:`Turtle.tracer`, :meth:`Turtle.window_width` and - The methods :func:`Turtle.tracer <tracer>`, :func:`Turtle.window_width <window_width>` and
:meth:`Turtle.window_height` have been eliminated. :func:`Turtle.window_height <window_height>` have been eliminated.
Methods with these names and functionality are now available only Methods with these names and functionality are now available only
as methods of :class:`Screen`. The functions derived from these remain as methods of :class:`Screen`. The functions derived from these remain
available. (In fact already in Python 2.6 these methods were merely available. (In fact already in Python 2.6 these methods were merely
duplications of the corresponding duplications of the corresponding
:class:`TurtleScreen`/:class:`Screen`-methods.) :class:`TurtleScreen`/:class:`Screen` methods.)
- The method :meth:`Turtle.fill` has been eliminated. - The method :func:`!Turtle.fill` has been eliminated.
The behaviour of :meth:`begin_fill` and :meth:`end_fill` The behaviour of :func:`begin_fill` and :func:`end_fill`
have changed slightly: now every filling-process must be completed with an have changed slightly: now every filling process must be completed with an
``end_fill()`` call. ``end_fill()`` call.
- A method :meth:`Turtle.filling` has been added. It returns a boolean - A method :func:`Turtle.filling <filling>` has been added. It returns a boolean
value: ``True`` if a filling process is under way, ``False`` otherwise. value: ``True`` if a filling process is under way, ``False`` otherwise.
This behaviour corresponds to a ``fill()`` call without arguments in This behaviour corresponds to a ``fill()`` call without arguments in
Python 2.6. Python 2.6.
@ -2490,23 +2494,23 @@ Changes since Python 2.6
Changes since Python 3.0 Changes since Python 3.0
======================== ========================
- The methods :meth:`Turtle.shearfactor`, :meth:`Turtle.shapetransform` and - The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and
:meth:`Turtle.get_shapepoly` have been added. Thus the full range of :func:`get_shapepoly` have been added. Thus the full range of
regular linear transforms is now available for transforming turtle shapes. regular linear transforms is now available for transforming turtle shapes.
:meth:`Turtle.tiltangle` has been enhanced in functionality: it now can :func:`tiltangle` has been enhanced in functionality: it now can
be used to get or set the tiltangle. :meth:`Turtle.settiltangle` has been be used to get or set the tilt angle. :func:`settiltangle` has been
deprecated. deprecated.
- The method :meth:`Screen.onkeypress` has been added as a complement to - The :class:`Screen` method :func:`onkeypress` has been added as a complement to
:meth:`Screen.onkey` which in fact binds actions to the keyrelease event. :func:`onkey`. As the latter binds actions to the key release event,
Accordingly the latter has got an alias: :meth:`Screen.onkeyrelease`. an alias: :func:`onkeyrelease` was also added for it.
- The method :meth:`Screen.mainloop` has been added. So when working only - The method :func:`Screen.mainloop <mainloop>` has been added,
with Screen and Turtle objects one must not additionally import so there is no longer a need to use the standalone :func:`mainloop` function
:func:`mainloop` anymore. when working with :class:`Screen` and :class:`Turtle` objects.
- Two input methods has been added :meth:`Screen.textinput` and - Two input methods have been added: :func:`Screen.textinput <textinput>` and
:meth:`Screen.numinput`. These popup input dialogs and return :func:`Screen.numinput <numinput>`. These pop up input dialogs and return
strings and numbers respectively. strings and numbers respectively.
- Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py` - Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py`

View File

@ -953,7 +953,7 @@ def __repr__(self):
class TurtleScreen(TurtleScreenBase): class TurtleScreen(TurtleScreenBase):
"""Provides screen oriented methods like setbg etc. """Provides screen oriented methods like bgcolor etc.
Only relies upon the methods of TurtleScreenBase and NOT Only relies upon the methods of TurtleScreenBase and NOT
upon components of the underlying graphics toolkit - upon components of the underlying graphics toolkit -