]> granicus.if.org Git - python/commitdiff
Document functions added in 2.3 and 2.5.
authorMartin v. Löwis <martin@v.loewis.de>
Mon, 3 Jul 2006 11:12:06 +0000 (11:12 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Mon, 3 Jul 2006 11:12:06 +0000 (11:12 +0000)
Doc/lib/libturtle.tex

index 638bc076bb908ebb97d50bf10710fcae6d359871..6b9585f0019c766291ecfcbf2132cea0b5f00077 100644 (file)
@@ -42,6 +42,19 @@ means line are drawn more slowly, with an animation of an arrow along the
 line.
 \end{funcdesc}
 
+\begin{funcdesc}{speed}{speed}
+Set the speed of the turtle. Valid values for the parameter
+\var{speed} are \code{'fastest'} (no delay), \code{'fast'},
+(delay 5ms), \code{'normal'} (delay 10ms), \code{'slow'}
+(delay 15ms), and \code{'slowest'} (delay 20ms).
+\versionadded{2.5}
+\end{funcdesc}
+
+\begin{funcdesc}{delay}{delay}
+Set the speed of the turtle to \var{delay}, which is given
+in ms. \versionadded{2.5}
+\end{funcdesc}
+
 \begin{funcdesc}{forward}{distance}
 Go forward \var{distance} steps.
 \end{funcdesc}
@@ -94,6 +107,16 @@ usage is: call \code{fill(1)} before drawing a path you want to fill,
 and call \code{fill(0)} when you finish to draw the path.
 \end{funcdesc}
 
+\begin{funcdesc}{begin\_fill}{}
+Switch turtle into filling mode; equivalent to \code{fill(1)}.
+\versionadded{2.5}
+\end{funcdesc}
+
+\begin{funcdesc}{end\_fill}{}
+End filling mode, and fill the shape; equivalent to \code{fill(0)}.
+\versionadded{2.5}
+\end{funcdesc}
+
 \begin{funcdesc}{circle}{radius\optional{, extent}}
 Draw a circle with radius \var{radius} whose center-point is
 \var{radius} units left of the turtle.
@@ -113,6 +136,49 @@ Go to co-ordinates \var{x}, \var{y}.  The co-ordinates may be
 specified either as two separate arguments or as a 2-tuple.
 \end{funcdesc}
 
+\begin{funcdesc}{towards}{x, y}
+Return the angle of the line from the turtle's position
+to the point \var{x}, \var{y}. The co-ordinates may be
+specified either as two separate arguments, as a 2-tuple,
+or as another pen object.
+\versionadded{2.5}
+\end{funcdesc}
+
+\begin{funcdesc}{heading}{}
+Return the current orientation of the turtle.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{setheading}{angle}
+Set the orientation of the turtle to \var{angle}.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{position}{}
+Return the current location of the turtle as an \code{(x,y)} pair.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{setx}{x}
+Set the x coordinate of the turtle to \var{x}.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{sety}{y}
+Set the y coordinate of the turtle to \var{y}.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{window\_width}{}
+Return the width of the canvas window.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{window\_height}{}
+Return the height of the canvas window.
+\versionadded{2.3}
+\end{funcdesc}
+
 This module also does \code{from math import *}, so see the
 documentation for the \refmodule{math} module for additional constants
 and functions useful for turtle graphics.
@@ -134,16 +200,21 @@ Define a pen. All above functions can be called as a methods on the given
 pen. The constructor automatically creates a canvas do be drawn on.
 \end{classdesc}
 
+\begin{classdesc}{Turtle}{}
+Define a pen. This is essentially a synonym for \code{Pen()};
+\class{Turtle} is an empty subclass of \class{Pen}.
+\end{classdesc}
+
 \begin{classdesc}{RawPen}{canvas}
 Define a pen which draws on a canvas \var{canvas}. This is useful if 
 you want to use the module to create graphics in a ``real'' program.
 \end{classdesc}
 
-\subsection{Pen and RawPen Objects \label{pen-rawpen-objects}}
+\subsection{Turtle, Pen and RawPen Objects \label{pen-rawpen-objects}}
 
-\class{Pen} and \class{RawPen} objects have all the global functions
-described above, except for \function{demo()} as methods, which
-manipulate the given pen.
+\class{Turtle}, \class{Pen} and \class{RawPen} objects have all the
+global functions described above, except for \function{demo()} as
+methods, which manipulate the given pen.
 
 The only method which is more powerful as a method is
 \function{degrees()}.