Skip to content

Commit

Permalink
pythongh-101100: Fix Sphinx warnings in turtle module (python#102340)
Browse files Browse the repository at this point in the history
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
  • Loading branch information
hugovk and CAM-Gerlach committed Mar 13, 2023
1 parent 5d677c5 commit 78e4e6c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
58 changes: 31 additions & 27 deletions Doc/library/turtle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ Appearance
will be displayed stretched according to its stretchfactors: *stretch_wid* is
stretchfactor perpendicular to its orientation, *stretch_len* is
stretchfactor in direction of its orientation, *outline* determines the width
of the shapes's outline.
of the shape's outline.

.. doctest::
:skipif: _tkinter is None
Expand Down Expand Up @@ -1545,7 +1545,7 @@ below:

1. Create an empty Shape object of type "compound".
2. Add as many components to this object as desired, using the
:meth:`addcomponent` method.
:meth:`~Shape.addcomponent` method.

For example:

Expand Down Expand Up @@ -2125,7 +2125,7 @@ Public classes

: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.

.. class:: Screen()
Expand Down Expand Up @@ -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
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
height = 0.75
Expand All @@ -2340,15 +2342,15 @@ The built in configuration would correspond to the following turtle.cfg::
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.
- 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
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
the cfg-file).
the cfg file).
- If you want to reflect the turtle its state, you have to use ``resizemode =
auto``.
- If you set e.g. ``language = italian`` the docstringdict
Expand Down Expand Up @@ -2398,6 +2400,8 @@ The :mod:`turtledemo` package directory contains:

The demo scripts are:

.. currentmodule:: turtle

.. tabularcolumns:: |l|L|L|

+----------------+------------------------------+-----------------------+
Expand Down Expand Up @@ -2469,44 +2473,44 @@ Have fun!
Changes since Python 2.6
========================

- The methods :meth:`Turtle.tracer`, :meth:`Turtle.window_width` and
:meth:`Turtle.window_height` have been eliminated.
- The methods :func:`Turtle.tracer <tracer>`, :func:`Turtle.window_width <window_width>` and
:func:`Turtle.window_height <window_height>` have been eliminated.
Methods with these names and functionality are now available only
as methods of :class:`Screen`. The functions derived from these remain
available. (In fact already in Python 2.6 these methods were merely
duplications of the corresponding
:class:`TurtleScreen`/:class:`Screen`-methods.)
:class:`TurtleScreen`/:class:`Screen` methods.)

- The method :meth:`Turtle.fill` has been eliminated.
The behaviour of :meth:`begin_fill` and :meth:`end_fill`
have changed slightly: now every filling-process must be completed with an
- The method :func:`!Turtle.fill` has been eliminated.
The behaviour of :func:`begin_fill` and :func:`end_fill`
have changed slightly: now every filling process must be completed with an
``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.
This behaviour corresponds to a ``fill()`` call without arguments in
Python 2.6.

Changes since Python 3.0
========================

- The methods :meth:`Turtle.shearfactor`, :meth:`Turtle.shapetransform` and
:meth:`Turtle.get_shapepoly` have been added. Thus the full range of
- The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and
:func:`get_shapepoly` have been added. Thus the full range of
regular linear transforms is now available for transforming turtle shapes.
:meth:`Turtle.tiltangle` has been enhanced in functionality: it now can
be used to get or set the tiltangle. :meth:`Turtle.settiltangle` has been
:func:`tiltangle` has been enhanced in functionality: it now can
be used to get or set the tilt angle. :func:`settiltangle` has been
deprecated.

- The method :meth:`Screen.onkeypress` has been added as a complement to
:meth:`Screen.onkey` which in fact binds actions to the keyrelease event.
Accordingly the latter has got an alias: :meth:`Screen.onkeyrelease`.
- The :class:`Screen` method :func:`onkeypress` has been added as a complement to
:func:`onkey`. As the latter binds actions to the key release event,
an alias: :func:`onkeyrelease` was also added for it.

- The method :meth:`Screen.mainloop` has been added. So when working only
with Screen and Turtle objects one must not additionally import
:func:`mainloop` anymore.
- The method :func:`Screen.mainloop <mainloop>` has been added,
so there is no longer a need to use the standalone :func:`mainloop` function
when working with :class:`Screen` and :class:`Turtle` objects.

- Two input methods has been added :meth:`Screen.textinput` and
:meth:`Screen.numinput`. These popup input dialogs and return
- Two input methods have been added: :func:`Screen.textinput <textinput>` and
:func:`Screen.numinput <numinput>`. These pop up input dialogs and return
strings and numbers respectively.

- Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py`
Expand Down
2 changes: 1 addition & 1 deletion Lib/turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ def __repr__(self):


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
upon components of the underlying graphics toolkit -
Expand Down

0 comments on commit 78e4e6c

Please sign in to comment.