From 7465127e19661e46184f57a6cbeae7640cfddb2d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 28 Feb 2023 23:17:10 +0200 Subject: [PATCH 1/5] gh-101100: Fix Sphinx warnings in turtle module --- Doc/library/turtle.rst | 188 +++++++++++++++++++++-------------------- Lib/turtle.py | 2 +- 2 files changed, 98 insertions(+), 92 deletions(-) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index b7eb569c18a6c4..8655adf6c16386 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -72,7 +72,7 @@ The object-oriented interface uses essentially two+two classes: on a :class:`TurtleScreen`. Its constructor needs a Canvas, ScrolledCanvas or TurtleScreen as argument, so the RawTurtle objects know where to draw. - Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`Pen`), + Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`~turtle.Pen`), which draws on "the" :class:`Screen` instance which is automatically created, if not already present. @@ -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 @@ -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: @@ -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() @@ -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 @@ -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 :meth:`turtle.setup` method. - Line 5 and 6 correspond to the arguments of the method - :meth:`Screen.screensize`. + :meth:`turtle.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 @@ -2400,68 +2402,72 @@ The demo scripts are: .. tabularcolumns:: |l|L|L| -+----------------+------------------------------+-----------------------+ -| Name | Description | Features | -+================+==============================+=======================+ -| bytedesign | complex classical | :func:`tracer`, delay,| -| | turtle graphics pattern | :func:`update` | -+----------------+------------------------------+-----------------------+ -| chaos | graphs Verhulst dynamics, | world coordinates | -| | shows that computer's | | -| | computations can generate | | -| | results sometimes against the| | -| | common sense expectations | | -+----------------+------------------------------+-----------------------+ -| clock | analog clock showing time | turtles as clock's | -| | of your computer | hands, ontimer | -+----------------+------------------------------+-----------------------+ -| colormixer | experiment with r, g, b | :func:`ondrag` | -+----------------+------------------------------+-----------------------+ -| forest | 3 breadth-first trees | randomization | -+----------------+------------------------------+-----------------------+ -| fractalcurves | Hilbert & Koch curves | recursion | -+----------------+------------------------------+-----------------------+ -| lindenmayer | ethnomathematics | L-System | -| | (indian kolams) | | -+----------------+------------------------------+-----------------------+ -| minimal_hanoi | Towers of Hanoi | Rectangular Turtles | -| | | as Hanoi discs | -| | | (shape, shapesize) | -+----------------+------------------------------+-----------------------+ -| nim | play the classical nim game | turtles as nimsticks, | -| | with three heaps of sticks | event driven (mouse, | -| | against the computer. | keyboard) | -+----------------+------------------------------+-----------------------+ -| paint | super minimalistic | :func:`onclick` | -| | drawing program | | -+----------------+------------------------------+-----------------------+ -| peace | elementary | turtle: appearance | -| | | and animation | -+----------------+------------------------------+-----------------------+ -| penrose | aperiodic tiling with | :func:`stamp` | -| | kites and darts | | -+----------------+------------------------------+-----------------------+ -| planet_and_moon| simulation of | compound shapes, | -| | gravitational system | :class:`Vec2D` | -+----------------+------------------------------+-----------------------+ -| rosette | a pattern from the wikipedia | :func:`clone`, | -| | article on turtle graphics | :func:`undo` | -+----------------+------------------------------+-----------------------+ -| round_dance | dancing turtles rotating | compound shapes, clone| -| | pairwise in opposite | shapesize, tilt, | -| | direction | get_shapepoly, update | -+----------------+------------------------------+-----------------------+ -| sorting_animate| visual demonstration of | simple alignment, | -| | different sorting methods | randomization | -+----------------+------------------------------+-----------------------+ -| tree | a (graphical) breadth | :func:`clone` | -| | first tree (using generators)| | -+----------------+------------------------------+-----------------------+ -| two_canvases | simple design | turtles on two | -| | | canvases | -+----------------+------------------------------+-----------------------+ -| yinyang | another elementary example | :func:`circle` | -+----------------+------------------------------+-----------------------+ ++----------------+------------------------------+-------------------------------+ +| Name | Description | Features | ++================+==============================+===============================+ +| bytedesign | complex classical | :func:`~turtle.tracer`, | +| | turtle graphics pattern | :func:`~turtle.delay` | +| | | :func:`~turtle.update` | ++----------------+------------------------------+-------------------------------+ +| chaos | graphs Verhulst dynamics, | world coordinates | +| | shows that computer's | | +| | computations can generate | | +| | results sometimes against the| | +| | common sense expectations | | ++----------------+------------------------------+-------------------------------+ +| clock | analog clock showing time | turtles as clock's | +| | of your computer | hands, :func:`~turtle.ontimer`| ++----------------+------------------------------+-------------------------------+ +| colormixer | experiment with r, g, b | :func:`~turtle.ondrag` | ++----------------+------------------------------+-------------------------------+ +| forest | 3 breadth-first trees | randomization | ++----------------+------------------------------+-------------------------------+ +| fractalcurves | Hilbert & Koch curves | recursion | ++----------------+------------------------------+-------------------------------+ +| lindenmayer | ethnomathematics | L-System | +| | (Indian kolams) | | ++----------------+------------------------------+-------------------------------+ +| minimal_hanoi | Towers of Hanoi | Rectangular turtles | +| | | as Hanoi discs (shape, | +| | | :func:`~turtle.shapesize`) | ++----------------+------------------------------+-------------------------------+ +| nim | play the classical nim game | turtles as nimsticks, | +| | with three heaps of sticks | event driven (mouse, | +| | against the computer. | keyboard) | ++----------------+------------------------------+-------------------------------+ +| paint | super minimalistic | :func:`~turtle.onclick` | +| | drawing program | | ++----------------+------------------------------+-------------------------------+ +| peace | elementary | turtle: appearance | +| | | and animation | ++----------------+------------------------------+-------------------------------+ +| penrose | aperiodic tiling with | :func:`~turtle.stamp` | +| | kites and darts | | ++----------------+------------------------------+-------------------------------+ +| planet_and_moon| simulation of | compound shapes, | +| | gravitational system | :class:`~turtle.Vec2D` | ++----------------+------------------------------+-------------------------------+ +| rosette | a pattern from the wikipedia | :func:`~turtle.clone`, | +| | article on turtle graphics | :func:`~turtle.undo` | ++----------------+------------------------------+-------------------------------+ +| round_dance | dancing turtles rotating | compound shapes, | +| | pairwise in opposite | :func:`~turtle.clone`, | +| | direction | :func:`~turtle.shapesize`, | +| | | :func:`~turtle.tilt`, | +| | | :func:`~turtle.get_shapepoly`,| +| | | :func:`~turtle.update` | ++----------------+------------------------------+-------------------------------+ +| sorting_animate| visual demonstration of | simple alignment, | +| | different sorting methods | randomization | ++----------------+------------------------------+-------------------------------+ +| tree | a (graphical) breadth | :func:`~turtle.clone` | +| | first tree (using generators)| | ++----------------+------------------------------+-------------------------------+ +| two_canvases | simple design | turtles on two | +| | | canvases | ++----------------+------------------------------+-------------------------------+ +| yinyang | another elementary example | :func:`~turtle.circle` | ++----------------+------------------------------+-------------------------------+ Have fun! @@ -2469,20 +2475,20 @@ 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 :meth:`turtle.tracer`, :meth:`turtle.window_width` and + :meth:`turtle.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 + as methods of :class:`~turtle.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:`~turtle.TurtleScreen`/:class:`~turtle.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 ``Turtle.fill`` has been eliminated. + The behaviour of :meth:`~turtle.begin_fill` and :meth:`~turtle.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 :meth:`turtle.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. @@ -2490,23 +2496,23 @@ Changes since 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 methods :meth:`turtle.shearfactor`, :meth:`turtle.shapetransform` and + :meth:`turtle.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 + :meth:`turtle.tiltangle` has been enhanced in functionality: it now can + be used to get or set the tilt angle. :meth:`turtle.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 method :meth:`turtle.onkeypress` has been added as a complement to + :meth:`turtle.onkey` which in fact binds actions to the key release event. + Accordingly the latter has got an alias: :meth:`turtle.onkeyrelease`. -- 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 :meth:`turtle.mainloop` has been added. So when working only + with ``Screen`` and ``Turtle`` objects one must not additionally import + ``mainloop`` anymore. -- 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: :meth:`turtle.textinput` and + :meth:`turtle.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` diff --git a/Lib/turtle.py b/Lib/turtle.py index 6abf9f7f65af0d..1b369327bc8eff 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -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 - From d2e14748366bd4cc530d94acc2498730fbc3a2d5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 12 Mar 2023 23:22:14 +0200 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: C.A.M. Gerlach --- Doc/library/turtle.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 8655adf6c16386..7d97ff3e3564dd 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -72,7 +72,7 @@ The object-oriented interface uses essentially two+two classes: on a :class:`TurtleScreen`. Its constructor needs a Canvas, ScrolledCanvas or TurtleScreen as argument, so the RawTurtle objects know where to draw. - Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`~turtle.Pen`), + Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`Pen`), which draws on "the" :class:`Screen` instance which is automatically created, if not already present. @@ -2342,7 +2342,7 @@ 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:`turtle.setup` +- The first four lines correspond to the arguments of the :func:`Screen.setup ` method. - Line 5 and 6 correspond to the arguments of the method :meth:`turtle.screensize`. @@ -2400,6 +2400,8 @@ The :mod:`turtledemo` package directory contains: The demo scripts are: +.. currentmodule:: turtle + .. tabularcolumns:: |l|L|L| +----------------+------------------------------+-------------------------------+ @@ -2483,7 +2485,7 @@ Changes since Python 2.6 duplications of the corresponding :class:`~turtle.TurtleScreen`/:class:`~turtle.Screen` methods.) -- The method ``Turtle.fill`` has been eliminated. +- The method :meth:`!Turtle.fill` has been eliminated. The behaviour of :meth:`~turtle.begin_fill` and :meth:`~turtle.end_fill` have changed slightly: now every filling process must be completed with an ``end_fill()`` call. From 0790e8c76640982cae520a088cefa4445574761d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 12 Mar 2023 23:24:27 +0200 Subject: [PATCH 3/5] Revert ~turtle. additions in table following '.. currentmodule:: turtle' addition --- Doc/library/turtle.rst | 128 ++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 66 deletions(-) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 7d97ff3e3564dd..63aaff59b9b2c6 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2404,72 +2404,68 @@ The demo scripts are: .. tabularcolumns:: |l|L|L| -+----------------+------------------------------+-------------------------------+ -| Name | Description | Features | -+================+==============================+===============================+ -| bytedesign | complex classical | :func:`~turtle.tracer`, | -| | turtle graphics pattern | :func:`~turtle.delay` | -| | | :func:`~turtle.update` | -+----------------+------------------------------+-------------------------------+ -| chaos | graphs Verhulst dynamics, | world coordinates | -| | shows that computer's | | -| | computations can generate | | -| | results sometimes against the| | -| | common sense expectations | | -+----------------+------------------------------+-------------------------------+ -| clock | analog clock showing time | turtles as clock's | -| | of your computer | hands, :func:`~turtle.ontimer`| -+----------------+------------------------------+-------------------------------+ -| colormixer | experiment with r, g, b | :func:`~turtle.ondrag` | -+----------------+------------------------------+-------------------------------+ -| forest | 3 breadth-first trees | randomization | -+----------------+------------------------------+-------------------------------+ -| fractalcurves | Hilbert & Koch curves | recursion | -+----------------+------------------------------+-------------------------------+ -| lindenmayer | ethnomathematics | L-System | -| | (Indian kolams) | | -+----------------+------------------------------+-------------------------------+ -| minimal_hanoi | Towers of Hanoi | Rectangular turtles | -| | | as Hanoi discs (shape, | -| | | :func:`~turtle.shapesize`) | -+----------------+------------------------------+-------------------------------+ -| nim | play the classical nim game | turtles as nimsticks, | -| | with three heaps of sticks | event driven (mouse, | -| | against the computer. | keyboard) | -+----------------+------------------------------+-------------------------------+ -| paint | super minimalistic | :func:`~turtle.onclick` | -| | drawing program | | -+----------------+------------------------------+-------------------------------+ -| peace | elementary | turtle: appearance | -| | | and animation | -+----------------+------------------------------+-------------------------------+ -| penrose | aperiodic tiling with | :func:`~turtle.stamp` | -| | kites and darts | | -+----------------+------------------------------+-------------------------------+ -| planet_and_moon| simulation of | compound shapes, | -| | gravitational system | :class:`~turtle.Vec2D` | -+----------------+------------------------------+-------------------------------+ -| rosette | a pattern from the wikipedia | :func:`~turtle.clone`, | -| | article on turtle graphics | :func:`~turtle.undo` | -+----------------+------------------------------+-------------------------------+ -| round_dance | dancing turtles rotating | compound shapes, | -| | pairwise in opposite | :func:`~turtle.clone`, | -| | direction | :func:`~turtle.shapesize`, | -| | | :func:`~turtle.tilt`, | -| | | :func:`~turtle.get_shapepoly`,| -| | | :func:`~turtle.update` | -+----------------+------------------------------+-------------------------------+ -| sorting_animate| visual demonstration of | simple alignment, | -| | different sorting methods | randomization | -+----------------+------------------------------+-------------------------------+ -| tree | a (graphical) breadth | :func:`~turtle.clone` | -| | first tree (using generators)| | -+----------------+------------------------------+-------------------------------+ -| two_canvases | simple design | turtles on two | -| | | canvases | -+----------------+------------------------------+-------------------------------+ -| yinyang | another elementary example | :func:`~turtle.circle` | -+----------------+------------------------------+-------------------------------+ ++----------------+------------------------------+-----------------------+ +| Name | Description | Features | ++================+==============================+=======================+ +| bytedesign | complex classical | :func:`tracer`, delay,| +| | turtle graphics pattern | :func:`update` | ++----------------+------------------------------+-----------------------+ +| chaos | graphs Verhulst dynamics, | world coordinates | +| | shows that computer's | | +| | computations can generate | | +| | results sometimes against the| | +| | common sense expectations | | ++----------------+------------------------------+-----------------------+ +| clock | analog clock showing time | turtles as clock's | +| | of your computer | hands, ontimer | ++----------------+------------------------------+-----------------------+ +| colormixer | experiment with r, g, b | :func:`ondrag` | ++----------------+------------------------------+-----------------------+ +| forest | 3 breadth-first trees | randomization | ++----------------+------------------------------+-----------------------+ +| fractalcurves | Hilbert & Koch curves | recursion | ++----------------+------------------------------+-----------------------+ +| lindenmayer | ethnomathematics | L-System | +| | (indian kolams) | | ++----------------+------------------------------+-----------------------+ +| minimal_hanoi | Towers of Hanoi | Rectangular Turtles | +| | | as Hanoi discs | +| | | (shape, shapesize) | ++----------------+------------------------------+-----------------------+ +| nim | play the classical nim game | turtles as nimsticks, | +| | with three heaps of sticks | event driven (mouse, | +| | against the computer. | keyboard) | ++----------------+------------------------------+-----------------------+ +| paint | super minimalistic | :func:`onclick` | +| | drawing program | | ++----------------+------------------------------+-----------------------+ +| peace | elementary | turtle: appearance | +| | | and animation | ++----------------+------------------------------+-----------------------+ +| penrose | aperiodic tiling with | :func:`stamp` | +| | kites and darts | | ++----------------+------------------------------+-----------------------+ +| planet_and_moon| simulation of | compound shapes, | +| | gravitational system | :class:`Vec2D` | ++----------------+------------------------------+-----------------------+ +| rosette | a pattern from the wikipedia | :func:`clone`, | +| | article on turtle graphics | :func:`undo` | ++----------------+------------------------------+-----------------------+ +| round_dance | dancing turtles rotating | compound shapes, clone| +| | pairwise in opposite | shapesize, tilt, | +| | direction | get_shapepoly, update | ++----------------+------------------------------+-----------------------+ +| sorting_animate| visual demonstration of | simple alignment, | +| | different sorting methods | randomization | ++----------------+------------------------------+-----------------------+ +| tree | a (graphical) breadth | :func:`clone` | +| | first tree (using generators)| | ++----------------+------------------------------+-----------------------+ +| two_canvases | simple design | turtles on two | +| | | canvases | ++----------------+------------------------------+-----------------------+ +| yinyang | another elementary example | :func:`circle` | ++----------------+------------------------------+-----------------------+ Have fun! From a5633b2f6772134b162687af67df8a630399c27e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 12 Mar 2023 23:40:55 +0200 Subject: [PATCH 4/5] :func:`x` instead of :meth:`turtle.x` --- Doc/library/turtle.rst | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 63aaff59b9b2c6..17c03730e88a37 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2345,7 +2345,7 @@ Short explanation of selected entries: - The first four lines correspond to the arguments of the :func:`Screen.setup ` method. - Line 5 and 6 correspond to the arguments of the method - :meth:`turtle.screensize`. + :func:`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 fill color (i.e. make the turtle transparent), you have @@ -2473,20 +2473,20 @@ 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:`tracer`, :func:`window_width` and + :func:`window_height` have been eliminated. Methods with these names and functionality are now available only - as methods of :class:`~turtle.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 duplications of the corresponding - :class:`~turtle.TurtleScreen`/:class:`~turtle.Screen` methods.) + :class:`TurtleScreen`/:class:`Screen` methods.) -- The method :meth:`!Turtle.fill` has been eliminated. - The behaviour of :meth:`~turtle.begin_fill` and :meth:`~turtle.end_fill` +- 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:`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. @@ -2494,23 +2494,23 @@ Changes since 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 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 tilt angle. :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:`turtle.onkeypress` has been added as a complement to - :meth:`turtle.onkey` which in fact binds actions to the key release event. - Accordingly the latter has got an alias: :meth:`turtle.onkeyrelease`. +- The method :func:`onkeypress` has been added as a complement to + :func:`onkey` which in fact binds actions to the key release event. + Accordingly the latter has got an alias: :func:`onkeyrelease`. -- The method :meth:`turtle.mainloop` has been added. So when working only +- The method :func:`mainloop` has been added. So when working only with ``Screen`` and ``Turtle`` objects one must not additionally import ``mainloop`` anymore. -- Two input methods have been added: :meth:`turtle.textinput` and - :meth:`turtle.numinput`. These pop up input dialogs and return +- Two input methods have been added: :func:`textinput` and + :func:`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` From e4dd0d8899c6381da1049c30e90d293fa8916b0a Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 13 Mar 2023 09:21:07 +0200 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: C.A.M. Gerlach --- Doc/library/turtle.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 17c03730e88a37..05392d04e52263 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -2345,7 +2345,7 @@ Short explanation of selected entries: - The first four lines correspond to the arguments of the :func:`Screen.setup ` method. - Line 5 and 6 correspond to the arguments of the method - :func:`screensize`. + :func:`Screen.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 fill color (i.e. make the turtle transparent), you have @@ -2473,8 +2473,8 @@ Have fun! Changes since Python 2.6 ======================== -- The methods :func:`tracer`, :func:`window_width` and - :func:`window_height` have been eliminated. +- The methods :func:`Turtle.tracer `, :func:`Turtle.window_width ` and + :func:`Turtle.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 @@ -2486,7 +2486,7 @@ Changes since Python 2.6 have changed slightly: now every filling process must be completed with an ``end_fill()`` call. -- A method :func:`filling` has been added. It returns a boolean +- A method :func:`Turtle.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. @@ -2494,23 +2494,23 @@ Changes since Python 2.6 Changes since Python 3.0 ======================== -- The methods :func:`shearfactor`, :func:`shapetransform` and +- 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. :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 :func:`onkeypress` has been added as a complement to - :func:`onkey` which in fact binds actions to the key release event. - Accordingly the latter has got an alias: :func:`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 :func:`mainloop` has been added. So when working only - with ``Screen`` and ``Turtle`` objects one must not additionally import - ``mainloop`` anymore. +- The method :func:`Screen.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 have been added: :func:`textinput` and - :func:`numinput`. These pop up input dialogs and return +- Two input methods have been added: :func:`Screen.textinput ` and + :func:`Screen.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` pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy