Merged revisions 85732,85778,85785,85853,85930,86008,86089 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85732 | alexander.belopolsky | 2010-10-19 17:07:52 -0400 (Tue, 19 Oct 2010) | 3 lines

  Issue #7061: Fixed some of the issues in turtle module documentation
  reported by Terry J. Reedy.
........
  r85778 | alexander.belopolsky | 2010-10-21 14:15:39 -0400 (Thu, 21 Oct 2010) | 1 line

  Issue #7061: Fixed section title
........
  r85785 | alexander.belopolsky | 2010-10-21 18:29:36 -0400 (Thu, 21 Oct 2010) | 1 line

  Fixed a typo
........
  r85853 | alexander.belopolsky | 2010-10-26 23:06:43 -0400 (Tue, 26 Oct 2010) | 4 lines

  Issue #7061: Dropped "for Tk" from turtle module title and moved its
  doc section under frameworks.  Also fixed a couple of markup issues
  that affected TOC rendering.
........
  r85930 | alexander.belopolsky | 2010-10-29 13:16:49 -0400 (Fri, 29 Oct 2010) | 1 line

  Issue 7061: Explained 'gon'
........
  r86008 | alexander.belopolsky | 2010-10-30 20:51:11 -0400 (Sat, 30 Oct 2010) | 1 line

  Issues #7061, #10225: Fixed doctests in turtle manual
........
  r86089 | alexander.belopolsky | 2010-11-01 11:45:34 -0400 (Mon, 01 Nov 2010) | 1 line

  Issue #7061: Simplified a section title.
........
This commit is contained in:
Alexander Belopolsky 2010-11-05 01:07:35 +00:00
parent 020e09a5b4
commit 96d1eb1ec8
7 changed files with 56 additions and 54 deletions

View File

@ -1,7 +1,5 @@
.. _ast: :mod:`ast` --- Abstract Syntax Trees
====================================
Abstract Syntax Trees
=====================
.. module:: ast .. module:: ast
:synopsis: Abstract Syntax Tree classes and manipulation. :synopsis: Abstract Syntax Tree classes and manipulation.

View File

@ -13,5 +13,6 @@ The full list of modules described in this chapter is:
.. toctree:: .. toctree::
turtle.rst
cmd.rst cmd.rst
shlex.rst shlex.rst

View File

@ -1,5 +1,3 @@
.. _debugger:
:mod:`pdb` --- The Python Debugger :mod:`pdb` --- The Python Debugger
================================== ==================================
@ -158,7 +156,7 @@ access further features, you have to do this yourself:
.. _debugger-commands: .. _debugger-commands:
Debugger Commands Debugger Commands
================= -----------------
The debugger recognizes the following commands. Most commands can be The debugger recognizes the following commands. Most commands can be
abbreviated to one or two letters; e.g. ``h(elp)`` means that either ``h`` or abbreviated to one or two letters; e.g. ``h(elp)`` means that either ``h`` or

View File

@ -490,7 +490,7 @@ always available.
Their intended use is to allow an interactive user to import a debugger module Their intended use is to allow an interactive user to import a debugger module
and engage in post-mortem debugging without having to re-execute the command and engage in post-mortem debugging without having to re-execute the command
that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the
post-mortem debugger; see chapter :ref:`debugger` for post-mortem debugger; see :mod:`pdb` module for
more information.) more information.)
The meaning of the variables is the same as that of the return values from The meaning of the variables is the same as that of the return values from

View File

@ -36,7 +36,6 @@ alternatives, see the :ref:`other-gui-packages` section.
tkinter.ttk.rst tkinter.ttk.rst
tkinter.tix.rst tkinter.tix.rst
tkinter.scrolledtext.rst tkinter.scrolledtext.rst
turtle.rst
idle.rst idle.rst
othergui.rst othergui.rst

View File

@ -1,9 +1,9 @@
======================================== =================================
:mod:`turtle` --- Turtle graphics for Tk :mod:`turtle` --- Turtle graphics
======================================== =================================
.. module:: turtle .. module:: turtle
:synopsis: Turtle graphics for Tk :synopsis: An educational framework for simple graphics applications
.. sectionauthor:: Gregor Lingl <gregor.lingl@aon.at> .. sectionauthor:: Gregor Lingl <gregor.lingl@aon.at>
.. testsetup:: default .. testsetup:: default
@ -58,7 +58,7 @@ The object-oriented interface uses essentially two+two classes:
or TurtleScreen as argument, so the RawTurtle objects know where to draw. 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:`Pen`),
which draws on "the" :class:`Screen` - instance which is automatically which draws on "the" :class:`Screen` instance which is automatically
created, if not already present. created, if not already present.
All methods of RawTurtle/Turtle also exist as functions, i.e. part of the All methods of RawTurtle/Turtle also exist as functions, i.e. part of the
@ -71,7 +71,7 @@ function derived from a Screen method is called. An (unnamed) turtle object is
automatically created whenever any of the functions derived from a Turtle method automatically created whenever any of the functions derived from a Turtle method
is called. is called.
To use multiple turtles an a screen one has to use the object-oriented interface. To use multiple turtles on a screen one has to use the object-oriented interface.
.. note:: .. note::
In the following documentation the argument list for functions is given. In the following documentation the argument list for functions is given.
@ -79,7 +79,7 @@ To use multiple turtles an a screen one has to use the object-oriented interface
omitted here. omitted here.
Overview over available Turtle and Screen methods Overview of available Turtle and Screen methods
================================================= =================================================
Turtle methods Turtle methods
@ -645,8 +645,8 @@ Tell Turtle's state
>>> turtle.forward(100) >>> turtle.forward(100)
>>> turtle.pos() >>> turtle.pos()
(64.28,76.60) (64.28,76.60)
>>> print(turtle.xcor()) >>> print(round(turtle.xcor(), 5))
64.2787609687 64.27876
.. function:: ycor() .. function:: ycor()
@ -660,8 +660,8 @@ Tell Turtle's state
>>> turtle.forward(100) >>> turtle.forward(100)
>>> print(turtle.pos()) >>> print(turtle.pos())
(50.00,86.60) (50.00,86.60)
>>> print(turtle.ycor()) >>> print(round(turtle.ycor(), 5))
86.6025403784 86.60254
.. function:: heading() .. function:: heading()
@ -714,7 +714,10 @@ Settings for measurement
>>> turtle.left(90) >>> turtle.left(90)
>>> turtle.heading() >>> turtle.heading()
90.0 90.0
>>> turtle.degrees(400.0) # angle measurement in gon
Change angle measurement unit to grad (also known as gon,
grade, or gradian and equals 1/100-th of the right angle.)
>>> turtle.degrees(400.0)
>>> turtle.heading() >>> turtle.heading()
100.0 100.0
>>> turtle.degrees(360) >>> turtle.degrees(360)
@ -810,20 +813,16 @@ Drawing state
>>> sorted(turtle.pen().items()) >>> sorted(turtle.pen().items())
[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'), [('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),
('pendown', True), ('pensize', 10), ('resizemode', 'noresize'), ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),
('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)] ('shearfactor', 0.0), ('shown', True), ('speed', 9),
('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)]
>>> penstate=turtle.pen() >>> penstate=turtle.pen()
>>> turtle.color("yellow", "") >>> turtle.color("yellow", "")
>>> turtle.penup() >>> turtle.penup()
>>> sorted(turtle.pen().items()) >>> sorted(turtle.pen().items())[:3]
[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow'), [('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')]
('pendown', False), ('pensize', 10), ('resizemode', 'noresize'),
('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]
>>> turtle.pen(penstate, fillcolor="green") >>> turtle.pen(penstate, fillcolor="green")
>>> sorted(turtle.pen().items()) >>> sorted(turtle.pen().items())[:3]
[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red'), [('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]
('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),
('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]
.. function:: isdown() .. function:: isdown()
@ -884,10 +883,10 @@ Color control
(0.2, 0.8, 0.5490196078431373) (0.2, 0.8, 0.5490196078431373)
>>> colormode(255) >>> colormode(255)
>>> turtle.pencolor() >>> turtle.pencolor()
(51, 204, 140) (51.0, 204.0, 140.0)
>>> turtle.pencolor('#32c18f') >>> turtle.pencolor('#32c18f')
>>> turtle.pencolor() >>> turtle.pencolor()
(50, 193, 143) (50.0, 193.0, 143.0)
.. function:: fillcolor(*args) .. function:: fillcolor(*args)
@ -924,13 +923,13 @@ Color control
'violet' 'violet'
>>> col = turtle.pencolor() >>> col = turtle.pencolor()
>>> col >>> col
(50, 193, 143) (50.0, 193.0, 143.0)
>>> turtle.fillcolor(col) >>> turtle.fillcolor(col)
>>> turtle.fillcolor() >>> turtle.fillcolor()
(50, 193, 143) (50.0, 193.0, 143.0)
>>> turtle.fillcolor('#ffffff') >>> turtle.fillcolor('#ffffff')
>>> turtle.fillcolor() >>> turtle.fillcolor()
(255, 255, 255) (255.0, 255.0, 255.0)
.. function:: color(*args) .. function:: color(*args)
@ -963,7 +962,7 @@ Color control
('red', 'green') ('red', 'green')
>>> color("#285078", "#a0c8f0") >>> color("#285078", "#a0c8f0")
>>> color() >>> color()
((40, 80, 120), (160, 200, 240)) ((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
See also: Screen method :func:`colormode`. See also: Screen method :func:`colormode`.
@ -1157,7 +1156,7 @@ Appearance
.. doctest:: .. doctest::
>>> turtle.shapesize() >>> turtle.shapesize()
(1, 1, 1) (1.0, 1.0, 1)
>>> turtle.resizemode("user") >>> turtle.resizemode("user")
>>> turtle.shapesize(5, 5, 12) >>> turtle.shapesize(5, 5, 12)
>>> turtle.shapesize() >>> turtle.shapesize()
@ -1184,7 +1183,7 @@ Appearance
>>> turtle.shapesize(5,2) >>> turtle.shapesize(5,2)
>>> turtle.shearfactor(0.5) >>> turtle.shearfactor(0.5)
>>> turtle.shearfactor() >>> turtle.shearfactor()
>>> 0.5 0.5
.. function:: tilt(angle) .. function:: tilt(angle)
@ -1268,11 +1267,12 @@ Appearance
.. doctest:: .. doctest::
>>> turtle = Turtle()
>>> turtle.shape("square") >>> turtle.shape("square")
>>> turtle.shapesize(4,2) >>> turtle.shapesize(4,2)
>>> turtle.shearfactor(-0.5) >>> turtle.shearfactor(-0.5)
>>> turtle.shapetransform() >>> turtle.shapetransform()
>>> (4.0, -1.0, -0.0, 2.0) (4.0, -1.0, -0.0, 2.0)
.. function:: get_shapepoly() .. function:: get_shapepoly()
@ -1456,8 +1456,8 @@ Special Turtle methods
.. _compoundshapes: .. _compoundshapes:
Excursus about the use of compound shapes Compound shapes
----------------------------------------- ---------------
To use compound turtle shapes, which consist of several polygons of different To use compound turtle shapes, which consist of several polygons of different
color, you must use the helper class :class:`Shape` explicitly as described color, you must use the helper class :class:`Shape` explicitly as described
@ -1511,6 +1511,7 @@ Window control
:param args: a color string or three numbers in the range 0..colormode or a :param args: a color string or three numbers in the range 0..colormode or a
3-tuple of such numbers 3-tuple of such numbers
Set or return background color of the TurtleScreen. Set or return background color of the TurtleScreen.
.. doctest:: .. doctest::
@ -1520,7 +1521,7 @@ Window control
'orange' 'orange'
>>> screen.bgcolor("#800080") >>> screen.bgcolor("#800080")
>>> screen.bgcolor() >>> screen.bgcolor()
(128, 0, 128) (128.0, 0.0, 128.0)
.. function:: bgpic(picname=None) .. function:: bgpic(picname=None)
@ -1548,7 +1549,7 @@ Window control
.. note:: .. note::
This TurtleScreen method is available as a global function only under the This TurtleScreen method is available as a global function only under the
name ``clearscreen``. The global function ``clear`` is another one name ``clearscreen``. The global function ``clear`` is a different one
derived from the Turtle method ``clear``. derived from the Turtle method ``clear``.
@ -1643,10 +1644,12 @@ Animation control
:param n: nonnegative integer :param n: nonnegative integer
:param delay: nonnegative integer :param delay: nonnegative integer
Turn turtle animation on/off and set delay for update drawings. If *n* is Turn turtle animation on/off and set delay for update drawings. If
given, only each n-th regular screen update is really performed. (Can be *n* is given, only each n-th regular screen update is really
used to accelerate the drawing of complex graphics.) Second argument sets performed. (Can be used to accelerate the drawing of complex
delay value (see :func:`delay`). graphics.) When called without arguments, returns the currently
stored value of n. Second argument sets delay value (see
:func:`delay`).
.. doctest:: .. doctest::
@ -1790,8 +1793,8 @@ Input methods
:param title: string :param title: string
:param prompt: string :param prompt: string
:param default: number (optional) :param default: number (optional)
:param prompt: number (optional) :param minval: number (optional)
:param prompt: number (optional) :param maxval: number (optional)
Pop up a dialog window for input of a number. title is the title of the Pop up a dialog window for input of a number. title is the title of the
dialog window, prompt is a text mostly describing what numerical information dialog window, prompt is a text mostly describing what numerical information
@ -1991,8 +1994,8 @@ Methods specific to Screen, not inherited from TurtleScreen
>>> screen.title("Welcome to the turtle zoo!") >>> screen.title("Welcome to the turtle zoo!")
The public classes of the module :mod:`turtle` Public classes
============================================== ==============
.. class:: RawTurtle(canvas) .. class:: RawTurtle(canvas)
@ -2323,7 +2326,7 @@ The demoscripts are:
+----------------+------------------------------+-----------------------+ +----------------+------------------------------+-----------------------+
| round_dance | dancing turtles rotating | compound shapes, clone| | round_dance | dancing turtles rotating | compound shapes, clone|
| | pairwise in opposite | shapesize, tilt, | | | pairwise in opposite | shapesize, tilt, |
| | direction | get_polyshape, update | | | direction | get_shapepoly, update |
+----------------+------------------------------+-----------------------+ +----------------+------------------------------+-----------------------+
| tree | a (graphical) breadth | :func:`clone` | | tree | a (graphical) breadth | :func:`clone` |
| | first tree (using generators)| | | | first tree (using generators)| |

View File

@ -1575,7 +1575,10 @@ class TNavigator(object):
>>> turtle.left(90) >>> turtle.left(90)
>>> turtle.heading() >>> turtle.heading()
90 90
>>> turtle.degrees(400.0) # angle measurement in gon
Change angle measurement unit to grad (also known as gon,
grade, or gradian and equals 1/100-th of the right angle.)
>>> turtle.degrees(400.0)
>>> turtle.heading() >>> turtle.heading()
100 100