Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
turtledemo.nim.Stick Class Reference
Inheritance diagram for turtledemo.nim.Stick:
Inheritance graph
[legend]
Collaboration diagram for turtledemo.nim.Stick:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def coords
def makemove
def reset
def setundobuffer
def undobufferentries
def clear
def clone
def shape
def shapesize
def shearfactor
def settiltangle
def tiltangle
def tilt
def shapetransform
def get_shapepoly
def stamp
 stamp stuff ###############################
def clearstamp
def clearstamps
def filling
def begin_fill
def end_fill
def dot
def write
def begin_poly
def end_poly
def get_poly
def getscreen
def getturtle
def onclick
def onrelease
def ondrag
def undo
def resizemode
def pensize
def penup
def pendown
def isdown
def speed
def color
def pencolor
def fillcolor
def showturtle
def hideturtle
def isvisible
def pen
def degrees
def radians
def forward
def back
def right
def left
def pos
def xcor
def ycor
def goto
def home
def setx
def sety
def distance
def towards
def heading
def setheading
def circle

Public Attributes

 row
 col
 game
 screen
 drawingLineItem
 turtle
 currentLineItem
 currentLine
 items
 stampItems
 undobuffer
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type
struct _typeobjectob_type

Static Public Attributes

list screens = []
 getpen = getturtle
 turtlesize = shapesize
dictionary START_ORIENTATION
string DEFAULT_MODE = "standard"
int DEFAULT_ANGLEOFFSET = 0
int DEFAULT_ANGLEORIENT = 1

Detailed Description

Definition at line 89 of file nim.py.


Constructor & Destructor Documentation

def turtledemo.nim.Stick.__init__ (   self,
  row,
  col,
  game 
)

Reimplemented from turtle.Turtle.

Definition at line 90 of file nim.py.

00090 
00091     def __init__(self, row, col, game):
00092         turtle.Turtle.__init__(self, visible=False)
00093         self.row = row
00094         self.col = col
00095         self.game = game
00096         x, y = self.coords(row, col)
00097         self.shape("square")
00098         self.shapesize(HUNIT/10.0, WUNIT/20.0)
00099         self.speed(0)
00100         self.pu()
00101         self.goto(x,y)
00102         self.color("white")
00103         self.showturtle()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def turtle.TNavigator.back (   self,
  distance 
) [inherited]
Move the turtle backward by distance.

Aliases: back | backward | bk

Argument:
distance -- a number

Move the turtle backward by distance ,opposite to the direction the
turtle is headed. Do not change the turtle's heading.

Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00, 0.00)
>>> turtle.backward(30)
>>> turtle.position()
(-30.00, 0.00)

Definition at line 1639 of file turtle.py.

01639 
01640     def back(self, distance):
01641         """Move the turtle backward by distance.
01642 
01643         Aliases: back | backward | bk
01644 
01645         Argument:
01646         distance -- a number
01647 
01648         Move the turtle backward by distance ,opposite to the direction the
01649         turtle is headed. Do not change the turtle's heading.
01650 
01651         Example (for a Turtle instance named turtle):
01652         >>> turtle.position()
01653         (0.00, 0.00)
01654         >>> turtle.backward(30)
01655         >>> turtle.position()
01656         (-30.00, 0.00)
01657         """
01658         self._go(-distance)

Here is the call graph for this function:

def turtle.RawTurtle.begin_fill (   self) [inherited]
Called just before drawing a shape to be filled.

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.color("black", "red")
>>> turtle.begin_fill()
>>> turtle.circle(60)
>>> turtle.end_fill()

Definition at line 3311 of file turtle.py.

03311 
03312     def begin_fill(self):
03313         """Called just before drawing a shape to be filled.
03314 
03315         No argument.
03316 
03317         Example (for a Turtle instance named turtle):
03318         >>> turtle.color("black", "red")
03319         >>> turtle.begin_fill()
03320         >>> turtle.circle(60)
03321         >>> turtle.end_fill()
03322         """
03323         if not self.filling():
03324             self._fillitem = self.screen._createpoly()
03325             self.items.append(self._fillitem)
03326         self._fillpath = [self._position]
03327         self._newLine()
03328         if self.undobuffer:
03329             self.undobuffer.push(("beginfill", self._fillitem))
03330         self._update()
03331 

Here is the call graph for this function:

def turtle.RawTurtle.begin_poly (   self) [inherited]
Start recording the vertices of a polygon.

No argument.

Start recording the vertices of a polygon. Current turtle position
is first point of polygon.

Example (for a Turtle instance named turtle):
>>> turtle.begin_poly()

Definition at line 3439 of file turtle.py.

03439 
03440     def begin_poly(self):
03441         """Start recording the vertices of a polygon.
03442 
03443         No argument.
03444 
03445         Start recording the vertices of a polygon. Current turtle position
03446         is first point of polygon.
03447 
03448         Example (for a Turtle instance named turtle):
03449         >>> turtle.begin_poly()
03450         """
03451         self._poly = [self._position]
03452         self._creatingPoly = True

def turtle.TNavigator.circle (   self,
  radius,
  extent = None,
  steps = None 
) [inherited]
Draw a circle with given radius.

Arguments:
radius -- a number
extent (optional) -- a number
steps (optional) -- an integer

Draw a circle with given radius. The center is radius units left
of the turtle; extent - an angle - determines which part of the
circle is drawn. If extent is not given, draw the entire circle.
If extent is not a full circle, one endpoint of the arc is the
current pen position. Draw the arc in counterclockwise direction
if radius is positive, otherwise in clockwise direction. Finally
the direction of the turtle is changed by the amount of extent.

As the circle is approximated by an inscribed regular polygon,
steps determines the number of steps to use. If not given,
it will be calculated automatically. Maybe used to draw regular
polygons.

call: circle(radius)                  # full circle
--or: circle(radius, extent)          # arc
--or: circle(radius, extent, steps)
--or: circle(radius, steps=6)         # 6-sided polygon

Example (for a Turtle instance named turtle):
>>> turtle.circle(50)
>>> turtle.circle(120, 180)  # semicircle

Definition at line 1938 of file turtle.py.

01938 
01939     def circle(self, radius, extent = None, steps = None):
01940         """ Draw a circle with given radius.
01941 
01942         Arguments:
01943         radius -- a number
01944         extent (optional) -- a number
01945         steps (optional) -- an integer
01946 
01947         Draw a circle with given radius. The center is radius units left
01948         of the turtle; extent - an angle - determines which part of the
01949         circle is drawn. If extent is not given, draw the entire circle.
01950         If extent is not a full circle, one endpoint of the arc is the
01951         current pen position. Draw the arc in counterclockwise direction
01952         if radius is positive, otherwise in clockwise direction. Finally
01953         the direction of the turtle is changed by the amount of extent.
01954 
01955         As the circle is approximated by an inscribed regular polygon,
01956         steps determines the number of steps to use. If not given,
01957         it will be calculated automatically. Maybe used to draw regular
01958         polygons.
01959 
01960         call: circle(radius)                  # full circle
01961         --or: circle(radius, extent)          # arc
01962         --or: circle(radius, extent, steps)
01963         --or: circle(radius, steps=6)         # 6-sided polygon
01964 
01965         Example (for a Turtle instance named turtle):
01966         >>> turtle.circle(50)
01967         >>> turtle.circle(120, 180)  # semicircle
01968         """
01969         if self.undobuffer:
01970             self.undobuffer.push(["seq"])
01971             self.undobuffer.cumulate = True
01972         speed = self.speed()
01973         if extent is None:
01974             extent = self._fullcircle
01975         if steps is None:
01976             frac = abs(extent)/self._fullcircle
01977             steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac)
01978         w = 1.0 * extent / steps
01979         w2 = 0.5 * w
01980         l = 2.0 * radius * math.sin(w2*math.pi/180.0*self._degreesPerAU)
01981         if radius < 0:
01982             l, w, w2 = -l, -w, -w2
01983         tr = self._tracer()
01984         dl = self._delay()
01985         if speed == 0:
01986             self._tracer(0, 0)
01987         else:
01988             self.speed(0)
01989         self._rotate(w2)
01990         for i in range(steps):
01991             self.speed(speed)
01992             self._go(l)
01993             self.speed(0)
01994             self._rotate(w)
01995         self._rotate(-w2)
01996         if speed == 0:
01997             self._tracer(tr, dl)
01998         self.speed(speed)
01999         if self.undobuffer:
02000             self.undobuffer.cumulate = False

Here is the call graph for this function:

def turtle.RawTurtle.clear (   self) [inherited]
Delete the turtle's drawings from the screen. Do not move turtle.

No arguments.

Delete the turtle's drawings from the screen. Do not move turtle.
State and position of the turtle as well as drawings of other
turtles are not affected.

Examples (for a Turtle instance named turtle):
>>> turtle.clear()

Definition at line 2630 of file turtle.py.

02630 
02631     def clear(self):
02632         """Delete the turtle's drawings from the screen. Do not move turtle.
02633 
02634         No arguments.
02635 
02636         Delete the turtle's drawings from the screen. Do not move turtle.
02637         State and position of the turtle as well as drawings of other
02638         turtles are not affected.
02639 
02640         Examples (for a Turtle instance named turtle):
02641         >>> turtle.clear()
02642         """
02643         self._clear()
02644         self._update()

Here is the call graph for this function:

def turtle.RawTurtle.clearstamp (   self,
  stampid 
) [inherited]
Delete stamp with given stampid

Argument:
stampid - an integer, must be return value of previous stamp() call.

Example (for a Turtle instance named turtle):
>>> turtle.color("blue")
>>> astamp = turtle.stamp()
>>> turtle.fd(50)
>>> turtle.clearstamp(astamp)

Definition at line 3102 of file turtle.py.

03102 
03103     def clearstamp(self, stampid):
03104         """Delete stamp with given stampid
03105 
03106         Argument:
03107         stampid - an integer, must be return value of previous stamp() call.
03108 
03109         Example (for a Turtle instance named turtle):
03110         >>> turtle.color("blue")
03111         >>> astamp = turtle.stamp()
03112         >>> turtle.fd(50)
03113         >>> turtle.clearstamp(astamp)
03114         """
03115         self._clearstamp(stampid)
03116         self._update()

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.clearstamps (   self,
  n = None 
) [inherited]
Delete all or first/last n of turtle's stamps.

Optional argument:
n -- an integer

If n is None, delete all of pen's stamps,
else if n > 0 delete first n stamps
else if n < 0 delete last n stamps.

Example (for a Turtle instance named turtle):
>>> for i in range(8):
turtle.stamp(); turtle.fd(30)
...
>>> turtle.clearstamps(2)
>>> turtle.clearstamps(-2)
>>> turtle.clearstamps()

Definition at line 3117 of file turtle.py.

03117 
03118     def clearstamps(self, n=None):
03119         """Delete all or first/last n of turtle's stamps.
03120 
03121         Optional argument:
03122         n -- an integer
03123 
03124         If n is None, delete all of pen's stamps,
03125         else if n > 0 delete first n stamps
03126         else if n < 0 delete last n stamps.
03127 
03128         Example (for a Turtle instance named turtle):
03129         >>> for i in range(8):
03130                 turtle.stamp(); turtle.fd(30)
03131         ...
03132         >>> turtle.clearstamps(2)
03133         >>> turtle.clearstamps(-2)
03134         >>> turtle.clearstamps()
03135         """
03136         if n is None:
03137             toDelete = self.stampItems[:]
03138         elif n >= 0:
03139             toDelete = self.stampItems[:n]
03140         else:
03141             toDelete = self.stampItems[n:]
03142         for item in toDelete:
03143             self._clearstamp(item)
03144         self._update()

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.clone (   self) [inherited]
Create and return a clone of the turtle.

No argument.

Create and return a clone of the turtle with same position, heading
and turtle properties.

Example (for a Turtle instance named mick):
mick = Turtle()
joe = mick.clone()

Definition at line 2713 of file turtle.py.

02713 
02714     def clone(self):
02715         """Create and return a clone of the turtle.
02716 
02717         No argument.
02718 
02719         Create and return a clone of the turtle with same position, heading
02720         and turtle properties.
02721 
02722         Example (for a Turtle instance named mick):
02723         mick = Turtle()
02724         joe = mick.clone()
02725         """
02726         screen = self.screen
02727         self._newLine(self._drawing)
02728 
02729         turtle = self.turtle
02730         self.screen = None
02731         self.turtle = None  # too make self deepcopy-able
02732 
02733         q = deepcopy(self)
02734 
02735         self.screen = screen
02736         self.turtle = turtle
02737 
02738         q.screen = screen
02739         q.turtle = _TurtleImage(screen, self.turtle.shapeIndex)
02740 
02741         screen._turtles.append(q)
02742         ttype = screen._shapes[self.turtle.shapeIndex]._type
02743         if ttype == "polygon":
02744             q.turtle._item = screen._createpoly()
02745         elif ttype == "image":
02746             q.turtle._item = screen._createimage(screen._shapes["blank"]._data)
02747         elif ttype == "compound":
02748             q.turtle._item = [screen._createpoly() for item in
02749                               screen._shapes[self.turtle.shapeIndex]._data]
02750         q.currentLineItem = screen._createline()
02751         q._update()
02752         return q

Here is the call graph for this function:

def turtle.TPen.color (   self,
  args 
) [inherited]
Return or set the pencolor and fillcolor.

Arguments:
Several input formats are allowed.
They use 0, 1, 2, or 3 arguments as follows:

color()
    Return the current pencolor and the current fillcolor
    as a pair of color specification strings as are returned
    by pencolor and fillcolor.
color(colorstring), color((r,g,b)), color(r,g,b)
    inputs as in pencolor, set both, fillcolor and pencolor,
    to the given value.
color(colorstring1, colorstring2),
color((r1,g1,b1), (r2,g2,b2))
    equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
    and analogously, if the other input format is used.

If turtleshape is a polygon, outline and interior of that polygon
is drawn with the newly set colors.
For mor info see: pencolor, fillcolor

Example (for a Turtle instance named turtle):
>>> turtle.color('red', 'green')
>>> turtle.color()
('red', 'green')
>>> colormode(255)
>>> color((40, 80, 120), (160, 200, 240))
>>> color()
('#285078', '#a0c8f0')

Definition at line 2176 of file turtle.py.

02176 
02177     def color(self, *args):
02178         """Return or set the pencolor and fillcolor.
02179 
02180         Arguments:
02181         Several input formats are allowed.
02182         They use 0, 1, 2, or 3 arguments as follows:
02183 
02184         color()
02185             Return the current pencolor and the current fillcolor
02186             as a pair of color specification strings as are returned
02187             by pencolor and fillcolor.
02188         color(colorstring), color((r,g,b)), color(r,g,b)
02189             inputs as in pencolor, set both, fillcolor and pencolor,
02190             to the given value.
02191         color(colorstring1, colorstring2),
02192         color((r1,g1,b1), (r2,g2,b2))
02193             equivalent to pencolor(colorstring1) and fillcolor(colorstring2)
02194             and analogously, if the other input format is used.
02195 
02196         If turtleshape is a polygon, outline and interior of that polygon
02197         is drawn with the newly set colors.
02198         For mor info see: pencolor, fillcolor
02199 
02200         Example (for a Turtle instance named turtle):
02201         >>> turtle.color('red', 'green')
02202         >>> turtle.color()
02203         ('red', 'green')
02204         >>> colormode(255)
02205         >>> color((40, 80, 120), (160, 200, 240))
02206         >>> color()
02207         ('#285078', '#a0c8f0')
02208         """
02209         if args:
02210             l = len(args)
02211             if l == 1:
02212                 pcolor = fcolor = args[0]
02213             elif l == 2:
02214                 pcolor, fcolor = args
02215             elif l == 3:
02216                 pcolor = fcolor = args
02217             pcolor = self._colorstr(pcolor)
02218             fcolor = self._colorstr(fcolor)
02219             self.pen(pencolor=pcolor, fillcolor=fcolor)
02220         else:
02221             return self._color(self._pencolor), self._color(self._fillcolor)

Here is the call graph for this function:

def turtledemo.nim.Stick.coords (   self,
  row,
  col 
)

Definition at line 104 of file nim.py.

00104 
00105     def coords(self, row, col):
00106         packet, remainder = divmod(col, 5)
00107         x = (3 + 11 * packet + 2 * remainder) * WUNIT
00108         y = (2 + 3 * row) * HUNIT
00109         return x - SCREENWIDTH // 2 + WUNIT // 2, SCREENHEIGHT // 2 - y - HUNIT // 2

Here is the call graph for this function:

def turtle.TNavigator.degrees (   self,
  fullcircle = 360.0 
) [inherited]
Set angle measurement units to degrees.

Optional argument:
fullcircle -  a number

Set angle measurement units, i. e. set number
of 'degrees' for a full circle. Dafault value is
360 degrees.

Example (for a Turtle instance named turtle):
>>> turtle.left(90)
>>> turtle.heading()
90

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()
100

Definition at line 1564 of file turtle.py.

01564 
01565     def degrees(self, fullcircle=360.0):
01566         """ Set angle measurement units to degrees.
01567 
01568         Optional argument:
01569         fullcircle -  a number
01570 
01571         Set angle measurement units, i. e. set number
01572         of 'degrees' for a full circle. Dafault value is
01573         360 degrees.
01574 
01575         Example (for a Turtle instance named turtle):
01576         >>> turtle.left(90)
01577         >>> turtle.heading()
01578         90
01579 
01580         Change angle measurement unit to grad (also known as gon,
01581         grade, or gradian and equals 1/100-th of the right angle.)
01582         >>> turtle.degrees(400.0)
01583         >>> turtle.heading()
01584         100
01585 
01586         """
01587         self._setDegreesPerAU(fullcircle)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.distance (   self,
  x,
  y = None 
) [inherited]
Return the distance from the turtle to (x,y) in turtle step units.

Arguments:
x -- a number   or  a pair/vector of numbers   or   a turtle instance
y -- a number       None                            None

call: distance(x, y)         # two coordinates
--or: distance((x, y))       # a pair (tuple) of coordinates
--or: distance(vec)          # e.g. as returned by pos()
--or: distance(mypen)        # where mypen is another turtle

Example (for a Turtle instance named turtle):
>>> turtle.pos()
(0.00, 0.00)
>>> turtle.distance(30,40)
50.0
>>> pen = Turtle()
>>> pen.forward(77)
>>> turtle.distance(pen)
77.0

Definition at line 1828 of file turtle.py.

01828 
01829     def distance(self, x, y=None):
01830         """Return the distance from the turtle to (x,y) in turtle step units.
01831 
01832         Arguments:
01833         x -- a number   or  a pair/vector of numbers   or   a turtle instance
01834         y -- a number       None                            None
01835 
01836         call: distance(x, y)         # two coordinates
01837         --or: distance((x, y))       # a pair (tuple) of coordinates
01838         --or: distance(vec)          # e.g. as returned by pos()
01839         --or: distance(mypen)        # where mypen is another turtle
01840 
01841         Example (for a Turtle instance named turtle):
01842         >>> turtle.pos()
01843         (0.00, 0.00)
01844         >>> turtle.distance(30,40)
01845         50.0
01846         >>> pen = Turtle()
01847         >>> pen.forward(77)
01848         >>> turtle.distance(pen)
01849         77.0
01850         """
01851         if y is not None:
01852             pos = Vec2D(x, y)
01853         if isinstance(x, Vec2D):
01854             pos = x
01855         elif isinstance(x, tuple):
01856             pos = Vec2D(*x)
01857         elif isinstance(x, TNavigator):
01858             pos = x._position
01859         return abs(pos - self._position)

Here is the caller graph for this function:

def turtle.RawTurtle.dot (   self,
  size = None,
  color 
) [inherited]
Draw a dot with diameter size, using color.

Optional arguments:
size -- an integer >= 1 (if given)
color -- a colorstring or a numeric color tuple

Draw a circular dot with diameter size, using color.
If size is not given, the maximum of pensize+4 and 2*pensize is used.

Example (for a Turtle instance named turtle):
>>> turtle.dot()
>>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)

Definition at line 3352 of file turtle.py.

03352 
03353     def dot(self, size=None, *color):
03354         """Draw a dot with diameter size, using color.
03355 
03356         Optional arguments:
03357         size -- an integer >= 1 (if given)
03358         color -- a colorstring or a numeric color tuple
03359 
03360         Draw a circular dot with diameter size, using color.
03361         If size is not given, the maximum of pensize+4 and 2*pensize is used.
03362 
03363         Example (for a Turtle instance named turtle):
03364         >>> turtle.dot()
03365         >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
03366         """
03367         if not color:
03368             if isinstance(size, (str, tuple)):
03369                 color = self._colorstr(size)
03370                 size = self._pensize + max(self._pensize, 4)
03371             else:
03372                 color = self._pencolor
03373                 if not size:
03374                     size = self._pensize + max(self._pensize, 4)
03375         else:
03376             if size is None:
03377                 size = self._pensize + max(self._pensize, 4)
03378             color = self._colorstr(color)
03379         if hasattr(self.screen, "_dot"):
03380             item = self.screen._dot(self._position, size, color)
03381             self.items.append(item)
03382             if self.undobuffer:
03383                 self.undobuffer.push(("dot", item))
03384         else:
03385             pen = self.pen()
03386             if self.undobuffer:
03387                 self.undobuffer.push(["seq"])
03388                 self.undobuffer.cumulate = True
03389             try:
03390                 if self.resizemode() == 'auto':
03391                     self.ht()
03392                 self.pendown()
03393                 self.pensize(size)
03394                 self.pencolor(color)
03395                 self.forward(0)
03396             finally:
03397                 self.pen(pen)
03398             if self.undobuffer:
03399                 self.undobuffer.cumulate = False

Here is the call graph for this function:

def turtle.RawTurtle.end_fill (   self) [inherited]
Fill the shape drawn after the call begin_fill().

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.color("black", "red")
>>> turtle.begin_fill()
>>> turtle.circle(60)
>>> turtle.end_fill()

Definition at line 3332 of file turtle.py.

03332 
03333     def end_fill(self):
03334         """Fill the shape drawn after the call begin_fill().
03335 
03336         No argument.
03337 
03338         Example (for a Turtle instance named turtle):
03339         >>> turtle.color("black", "red")
03340         >>> turtle.begin_fill()
03341         >>> turtle.circle(60)
03342         >>> turtle.end_fill()
03343         """
03344         if self.filling():
03345             if len(self._fillpath) > 2:
03346                 self.screen._drawpoly(self._fillitem, self._fillpath,
03347                                       fill=self._fillcolor)
03348                 if self.undobuffer:
03349                     self.undobuffer.push(("dofill", self._fillitem))
03350             self._fillitem = self._fillpath = None
03351             self._update()

Here is the call graph for this function:

def turtle.RawTurtle.end_poly (   self) [inherited]
Stop recording the vertices of a polygon.

No argument.

Stop recording the vertices of a polygon. Current turtle position is
last point of polygon. This will be connected with the first point.

Example (for a Turtle instance named turtle):
>>> turtle.end_poly()

Definition at line 3453 of file turtle.py.

03453 
03454     def end_poly(self):
03455         """Stop recording the vertices of a polygon.
03456 
03457         No argument.
03458 
03459         Stop recording the vertices of a polygon. Current turtle position is
03460         last point of polygon. This will be connected with the first point.
03461 
03462         Example (for a Turtle instance named turtle):
03463         >>> turtle.end_poly()
03464         """
03465         self._creatingPoly = False

def turtle.TPen.fillcolor (   self,
  args 
) [inherited]
Return or set the fillcolor.

Arguments:
Four input formats are allowed:
  - fillcolor()
    Return the current fillcolor as color specification string,
    possibly in hex-number format (see example).
    May be used as input to another color/pencolor/fillcolor call.
  - fillcolor(colorstring)
    s is a Tk color specification string, such as "red" or "yellow"
  - fillcolor((r, g, b))
    *a tuple* of r, g, and b, which represent, an RGB color,
    and each of r, g, and b are in the range 0..colormode,
    where colormode is either 1.0 or 255
  - fillcolor(r, g, b)
    r, g, and b represent an RGB color, and each of r, g, and b
    are in the range 0..colormode

If turtleshape is a polygon, the interior of that polygon is drawn
with the newly set fillcolor.

Example (for a Turtle instance named turtle):
>>> turtle.fillcolor('violet')
>>> col = turtle.pencolor()
>>> turtle.fillcolor(col)
>>> turtle.fillcolor(0, .5, 0)

Definition at line 2259 of file turtle.py.

02259 
02260     def fillcolor(self, *args):
02261         """ Return or set the fillcolor.
02262 
02263         Arguments:
02264         Four input formats are allowed:
02265           - fillcolor()
02266             Return the current fillcolor as color specification string,
02267             possibly in hex-number format (see example).
02268             May be used as input to another color/pencolor/fillcolor call.
02269           - fillcolor(colorstring)
02270             s is a Tk color specification string, such as "red" or "yellow"
02271           - fillcolor((r, g, b))
02272             *a tuple* of r, g, and b, which represent, an RGB color,
02273             and each of r, g, and b are in the range 0..colormode,
02274             where colormode is either 1.0 or 255
02275           - fillcolor(r, g, b)
02276             r, g, and b represent an RGB color, and each of r, g, and b
02277             are in the range 0..colormode
02278 
02279         If turtleshape is a polygon, the interior of that polygon is drawn
02280         with the newly set fillcolor.
02281 
02282         Example (for a Turtle instance named turtle):
02283         >>> turtle.fillcolor('violet')
02284         >>> col = turtle.pencolor()
02285         >>> turtle.fillcolor(col)
02286         >>> turtle.fillcolor(0, .5, 0)
02287         """
02288         if args:
02289             color = self._colorstr(args)
02290             if color == self._fillcolor:
02291                 return
02292             self.pen(fillcolor=color)
02293         else:
02294             return self._color(self._fillcolor)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.filling (   self) [inherited]
Return fillstate (True if filling, False else).

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.begin_fill()
>>> if turtle.filling():
turtle.pensize(5)
else:
turtle.pensize(3)

Definition at line 3297 of file turtle.py.

03297 
03298     def filling(self):
03299         """Return fillstate (True if filling, False else).
03300 
03301         No argument.
03302 
03303         Example (for a Turtle instance named turtle):
03304         >>> turtle.begin_fill()
03305         >>> if turtle.filling():
03306                 turtle.pensize(5)
03307         else:
03308                 turtle.pensize(3)
03309         """
03310         return isinstance(self._fillpath, list)

Here is the caller graph for this function:

def turtle.TNavigator.forward (   self,
  distance 
) [inherited]
Move the turtle forward by the specified distance.

Aliases: forward | fd

Argument:
distance -- a number (integer or float)

Move the turtle forward by the specified distance, in the direction
the turtle is headed.

Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00, 0.00)
>>> turtle.forward(25)
>>> turtle.position()
(25.00,0.00)
>>> turtle.forward(-75)
>>> turtle.position()
(-50.00,0.00)

Definition at line 1616 of file turtle.py.

01616 
01617     def forward(self, distance):
01618         """Move the turtle forward by the specified distance.
01619 
01620         Aliases: forward | fd
01621 
01622         Argument:
01623         distance -- a number (integer or float)
01624 
01625         Move the turtle forward by the specified distance, in the direction
01626         the turtle is headed.
01627 
01628         Example (for a Turtle instance named turtle):
01629         >>> turtle.position()
01630         (0.00, 0.00)
01631         >>> turtle.forward(25)
01632         >>> turtle.position()
01633         (25.00,0.00)
01634         >>> turtle.forward(-75)
01635         >>> turtle.position()
01636         (-50.00,0.00)
01637         """
01638         self._go(distance)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.get_poly (   self) [inherited]
Return the lastly recorded polygon.

No argument.

Example (for a Turtle instance named turtle):
>>> p = turtle.get_poly()
>>> turtle.register_shape("myFavouriteShape", p)

Definition at line 3466 of file turtle.py.

03466 
03467     def get_poly(self):
03468         """Return the lastly recorded polygon.
03469 
03470         No argument.
03471 
03472         Example (for a Turtle instance named turtle):
03473         >>> p = turtle.get_poly()
03474         >>> turtle.register_shape("myFavouriteShape", p)
03475         """
03476         ## check if there is any poly?
03477         if self._poly is not None:
03478             return tuple(self._poly)

def turtle.RawTurtle.get_shapepoly (   self) [inherited]
Return the current shape polygon as tuple of coordinate pairs.

No argument.

Examples (for a Turtle instance named turtle):
>>> turtle.shape("square")
>>> turtle.shapetransform(4, -1, 0, 2)
>>> turtle.get_shapepoly()
((50, -20), (30, 20), (-50, 20), (-30, -20))

Definition at line 2965 of file turtle.py.

02965 
02966     def get_shapepoly(self):
02967         """Return the current shape polygon as tuple of coordinate pairs.
02968 
02969         No argument.
02970 
02971         Examples (for a Turtle instance named turtle):
02972         >>> turtle.shape("square")
02973         >>> turtle.shapetransform(4, -1, 0, 2)
02974         >>> turtle.get_shapepoly()
02975         ((50, -20), (30, 20), (-50, 20), (-30, -20))
02976 
02977         """
02978         shape = self.screen._shapes[self.turtle.shapeIndex]
02979         if shape._type == "polygon":
02980             return self._getshapepoly(shape._data, shape._type == "compound")
02981         # else return None

Here is the call graph for this function:

def turtle.RawTurtle.getscreen (   self) [inherited]
Return the TurtleScreen object, the turtle is drawing  on.

No argument.

Return the TurtleScreen object, the turtle is drawing  on.
So TurtleScreen-methods can be called for that object.

Example (for a Turtle instance named turtle):
>>> ts = turtle.getscreen()
>>> ts
<turtle.TurtleScreen object at 0x0106B770>
>>> ts.bgcolor("pink")

Definition at line 3479 of file turtle.py.

03479 
03480     def getscreen(self):
03481         """Return the TurtleScreen object, the turtle is drawing  on.
03482 
03483         No argument.
03484 
03485         Return the TurtleScreen object, the turtle is drawing  on.
03486         So TurtleScreen-methods can be called for that object.
03487 
03488         Example (for a Turtle instance named turtle):
03489         >>> ts = turtle.getscreen()
03490         >>> ts
03491         <turtle.TurtleScreen object at 0x0106B770>
03492         >>> ts.bgcolor("pink")
03493         """
03494         return self.screen

Here is the caller graph for this function:

def turtle.RawTurtle.getturtle (   self) [inherited]
Return the Turtleobject itself.

No argument.

Only reasonable use: as a function to return the 'anonymous turtle':

Example:
>>> pet = getturtle()
>>> pet.fd(50)
>>> pet
<turtle.Turtle object at 0x0187D810>
>>> turtles()
[<turtle.Turtle object at 0x0187D810>]

Definition at line 3495 of file turtle.py.

03495 
03496     def getturtle(self):
03497         """Return the Turtleobject itself.
03498 
03499         No argument.
03500 
03501         Only reasonable use: as a function to return the 'anonymous turtle':
03502 
03503         Example:
03504         >>> pet = getturtle()
03505         >>> pet.fd(50)
03506         >>> pet
03507         <turtle.Turtle object at 0x0187D810>
03508         >>> turtles()
03509         [<turtle.Turtle object at 0x0187D810>]
03510         """
03511         return self

def turtle.TNavigator.goto (   self,
  x,
  y = None 
) [inherited]
Move turtle to an absolute position.

Aliases: setpos | setposition | goto:

Arguments:
x -- a number      or     a pair/vector of numbers
y -- a number             None

call: goto(x, y)         # two coordinates
--or: goto((x, y))       # a pair (tuple) of coordinates
--or: goto(vec)          # e.g. as returned by pos()

Move turtle to an absolute position. If the pen is down,
a line will be drawn. The turtle's orientation does not change.

Example (for a Turtle instance named turtle):
>>> tp = turtle.pos()
>>> tp
(0.00, 0.00)
>>> turtle.setpos(60,30)
>>> turtle.pos()
(60.00,30.00)
>>> turtle.setpos((20,80))
>>> turtle.pos()
(20.00,80.00)
>>> turtle.setpos(tp)
>>> turtle.pos()
(0.00,0.00)

Definition at line 1743 of file turtle.py.

01743 
01744     def goto(self, x, y=None):
01745         """Move turtle to an absolute position.
01746 
01747         Aliases: setpos | setposition | goto:
01748 
01749         Arguments:
01750         x -- a number      or     a pair/vector of numbers
01751         y -- a number             None
01752 
01753         call: goto(x, y)         # two coordinates
01754         --or: goto((x, y))       # a pair (tuple) of coordinates
01755         --or: goto(vec)          # e.g. as returned by pos()
01756 
01757         Move turtle to an absolute position. If the pen is down,
01758         a line will be drawn. The turtle's orientation does not change.
01759 
01760         Example (for a Turtle instance named turtle):
01761         >>> tp = turtle.pos()
01762         >>> tp
01763         (0.00, 0.00)
01764         >>> turtle.setpos(60,30)
01765         >>> turtle.pos()
01766         (60.00,30.00)
01767         >>> turtle.setpos((20,80))
01768         >>> turtle.pos()
01769         (20.00,80.00)
01770         >>> turtle.setpos(tp)
01771         >>> turtle.pos()
01772         (0.00,0.00)
01773         """
01774         if y is None:
01775             self._goto(Vec2D(*x))
01776         else:
01777             self._goto(Vec2D(x, y))

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.heading (   self) [inherited]
Return the turtle's current heading.

No arguments.

Example (for a Turtle instance named turtle):
>>> turtle.left(67)
>>> turtle.heading()
67.0

Definition at line 1895 of file turtle.py.

01895 
01896     def heading(self):
01897         """ Return the turtle's current heading.
01898 
01899         No arguments.
01900 
01901         Example (for a Turtle instance named turtle):
01902         >>> turtle.left(67)
01903         >>> turtle.heading()
01904         67.0
01905         """
01906         x, y = self._orient
01907         result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0
01908         result /= self._degreesPerAU
01909         return (self._angleOffset + self._angleOrient*result) % self._fullcircle

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TPen.hideturtle (   self) [inherited]
Makes the turtle invisible.

Aliases: hideturtle | ht

No argument.

It's a good idea to do this while you're in the
middle of a complicated drawing, because hiding
the turtle speeds up the drawing observably.

Example (for a Turtle instance named turtle):
>>> turtle.hideturtle()

Definition at line 2308 of file turtle.py.

02308 
02309     def hideturtle(self):
02310         """Makes the turtle invisible.
02311 
02312         Aliases: hideturtle | ht
02313 
02314         No argument.
02315 
02316         It's a good idea to do this while you're in the
02317         middle of a complicated drawing, because hiding
02318         the turtle speeds up the drawing observably.
02319 
02320         Example (for a Turtle instance named turtle):
02321         >>> turtle.hideturtle()
02322         """
02323         self.pen(shown=False)

Here is the call graph for this function:

def turtle.TNavigator.home (   self) [inherited]
Move turtle to the origin - coordinates (0,0).

No arguments.

Move turtle to the origin - coordinates (0,0) and set its
heading to its start-orientation (which depends on mode).

Example (for a Turtle instance named turtle):
>>> turtle.home()

Definition at line 1778 of file turtle.py.

01778 
01779     def home(self):
01780         """Move turtle to the origin - coordinates (0,0).
01781 
01782         No arguments.
01783 
01784         Move turtle to the origin - coordinates (0,0) and set its
01785         heading to its start-orientation (which depends on mode).
01786 
01787         Example (for a Turtle instance named turtle):
01788         >>> turtle.home()
01789         """
01790         self.goto(0, 0)
01791         self.setheading(0)

Here is the call graph for this function:

def turtle.TPen.isdown (   self) [inherited]
Return True if pen is down, False if it's up.

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.penup()
>>> turtle.isdown()
False
>>> turtle.pendown()
>>> turtle.isdown()
True

Definition at line 2123 of file turtle.py.

02123 
02124     def isdown(self):
02125         """Return True if pen is down, False if it's up.
02126 
02127         No argument.
02128 
02129         Example (for a Turtle instance named turtle):
02130         >>> turtle.penup()
02131         >>> turtle.isdown()
02132         False
02133         >>> turtle.pendown()
02134         >>> turtle.isdown()
02135         True
02136         """
02137         return self._drawing

def turtle.TPen.isvisible (   self) [inherited]
Return True if the Turtle is shown, False if it's hidden.

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.hideturtle()
>>> print turtle.isvisible():
False

Definition at line 2324 of file turtle.py.

02324 
02325     def isvisible(self):
02326         """Return True if the Turtle is shown, False if it's hidden.
02327 
02328         No argument.
02329 
02330         Example (for a Turtle instance named turtle):
02331         >>> turtle.hideturtle()
02332         >>> print turtle.isvisible():
02333         False
02334         """
02335         return self._shown

def turtle.TNavigator.left (   self,
  angle 
) [inherited]
Turn turtle left by angle units.

Aliases: left | lt

Argument:
angle -- a number (integer or float)

Turn turtle left by angle units. (Units are by default degrees,
but can be set via the degrees() and radians() functions.)
Angle orientation depends on mode. (See this.)

Example (for a Turtle instance named turtle):
>>> turtle.heading()
22.0
>>> turtle.left(45)
>>> turtle.heading()
67.0

Definition at line 1680 of file turtle.py.

01680 
01681     def left(self, angle):
01682         """Turn turtle left by angle units.
01683 
01684         Aliases: left | lt
01685 
01686         Argument:
01687         angle -- a number (integer or float)
01688 
01689         Turn turtle left by angle units. (Units are by default degrees,
01690         but can be set via the degrees() and radians() functions.)
01691         Angle orientation depends on mode. (See this.)
01692 
01693         Example (for a Turtle instance named turtle):
01694         >>> turtle.heading()
01695         22.0
01696         >>> turtle.left(45)
01697         >>> turtle.heading()
01698         67.0
01699         """
01700         self._rotate(angle)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtledemo.nim.Stick.makemove (   self,
  x,
  y 
)

Definition at line 110 of file nim.py.

00110 
00111     def makemove(self, x, y):
00112         if self.game.state != Nim.RUNNING:
00113             return
00114         self.game.controller.notify_move(self.row, self.col)
00115 

def turtle.RawTurtle.onclick (   self,
  fun,
  btn = 1,
  add = None 
) [inherited]
Bind fun to mouse-click event on this turtle on canvas.

Arguments:
fun --  a function with two arguments, to which will be assigned
the coordinates of the clicked point on the canvas.
num --  number of the mouse-button defaults to 1 (left mouse button).
add --  True or False. If True, new binding will be added, otherwise
it will replace a former binding.

Example for the anonymous turtle, i. e. the procedural way:

>>> def turn(x, y):
left(360)

>>> onclick(turn) # Now clicking into the turtle will turn it.
>>> onclick(None)  # event-binding will be removed

Definition at line 3524 of file turtle.py.

03524 
03525     def onclick(self, fun, btn=1, add=None):
03526         """Bind fun to mouse-click event on this turtle on canvas.
03527 
03528         Arguments:
03529         fun --  a function with two arguments, to which will be assigned
03530                 the coordinates of the clicked point on the canvas.
03531         num --  number of the mouse-button defaults to 1 (left mouse button).
03532         add --  True or False. If True, new binding will be added, otherwise
03533                 it will replace a former binding.
03534 
03535         Example for the anonymous turtle, i. e. the procedural way:
03536 
03537         >>> def turn(x, y):
03538                 left(360)
03539 
03540         >>> onclick(turn) # Now clicking into the turtle will turn it.
03541         >>> onclick(None)  # event-binding will be removed
03542         """
03543         self.screen._onclick(self.turtle._item, fun, btn, add)
03544         self._update()

Here is the call graph for this function:

def turtle.RawTurtle.ondrag (   self,
  fun,
  btn = 1,
  add = None 
) [inherited]
Bind fun to mouse-move event on this turtle on canvas.

Arguments:
fun -- a function with two arguments, to which will be assigned
       the coordinates of the clicked point on the canvas.
num -- number of the mouse-button defaults to 1 (left mouse button).

Every sequence of mouse-move-events on a turtle is preceded by a
mouse-click event on that turtle.

Example (for a Turtle instance named turtle):
>>> turtle.ondrag(turtle.goto)

### Subsequently clicking and dragging a Turtle will
### move it across the screen thereby producing handdrawings
### (if pen is down).

Definition at line 3569 of file turtle.py.

03569 
03570     def ondrag(self, fun, btn=1, add=None):
03571         """Bind fun to mouse-move event on this turtle on canvas.
03572 
03573         Arguments:
03574         fun -- a function with two arguments, to which will be assigned
03575                the coordinates of the clicked point on the canvas.
03576         num -- number of the mouse-button defaults to 1 (left mouse button).
03577 
03578         Every sequence of mouse-move-events on a turtle is preceded by a
03579         mouse-click event on that turtle.
03580 
03581         Example (for a Turtle instance named turtle):
03582         >>> turtle.ondrag(turtle.goto)
03583 
03584         ### Subsequently clicking and dragging a Turtle will
03585         ### move it across the screen thereby producing handdrawings
03586         ### (if pen is down).
03587         """
03588         self.screen._ondrag(self.turtle._item, fun, btn, add)
03589 

def turtle.RawTurtle.onrelease (   self,
  fun,
  btn = 1,
  add = None 
) [inherited]
Bind fun to mouse-button-release event on this turtle on canvas.

Arguments:
fun -- a function with two arguments, to which will be assigned
the coordinates of the clicked point on the canvas.
num --  number of the mouse-button defaults to 1 (left mouse button).

Example (for a MyTurtle instance named joe):
>>> class MyTurtle(Turtle):
def glow(self,x,y):
        self.fillcolor("red")
def unglow(self,x,y):
        self.fillcolor("")

>>> joe = MyTurtle()
>>> joe.onclick(joe.glow)
>>> joe.onrelease(joe.unglow)
### clicking on joe turns fillcolor red,
### unclicking turns it to transparent.

Definition at line 3545 of file turtle.py.

03545 
03546     def onrelease(self, fun, btn=1, add=None):
03547         """Bind fun to mouse-button-release event on this turtle on canvas.
03548 
03549         Arguments:
03550         fun -- a function with two arguments, to which will be assigned
03551                 the coordinates of the clicked point on the canvas.
03552         num --  number of the mouse-button defaults to 1 (left mouse button).
03553 
03554         Example (for a MyTurtle instance named joe):
03555         >>> class MyTurtle(Turtle):
03556                 def glow(self,x,y):
03557                         self.fillcolor("red")
03558                 def unglow(self,x,y):
03559                         self.fillcolor("")
03560 
03561         >>> joe = MyTurtle()
03562         >>> joe.onclick(joe.glow)
03563         >>> joe.onrelease(joe.unglow)
03564         ### clicking on joe turns fillcolor red,
03565         ### unclicking turns it to transparent.
03566         """
03567         self.screen._onrelease(self.turtle._item, fun, btn, add)
03568         self._update()

Here is the call graph for this function:

def turtle.TPen.pen (   self,
  pen = None,
  pendict 
) [inherited]
Return or set the pen's attributes.

Arguments:
    pen -- a dictionary with some or all of the below listed keys.
    **pendict -- one or more keyword-arguments with the below
         listed keys as keywords.

Return or set the pen's attributes in a 'pen-dictionary'
with the following key/value pairs:
   "shown"      :   True/False
   "pendown"    :   True/False
   "pencolor"   :   color-string or color-tuple
   "fillcolor"  :   color-string or color-tuple
   "pensize"    :   positive number
   "speed"      :   number in range 0..10
   "resizemode" :   "auto" or "user" or "noresize"
   "stretchfactor": (positive number, positive number)
   "shearfactor":   number
   "outline"    :   positive number
   "tilt"       :   number

This dictionary can be used as argument for a subsequent
pen()-call to restore the former pen-state. Moreover one
or more of these attributes can be provided as keyword-arguments.
This can be used to set several pen attributes in one statement.


Examples (for a Turtle instance named turtle):
>>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
>>> turtle.pen()
{'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',
'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
>>> penstate=turtle.pen()
>>> turtle.color("yellow","")
>>> turtle.penup()
>>> turtle.pen()
{'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',
'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
>>> p.pen(penstate, fillcolor="green")
>>> p.pen()
{'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',
'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}

Definition at line 2336 of file turtle.py.

02336 
02337     def pen(self, pen=None, **pendict):
02338         """Return or set the pen's attributes.
02339 
02340         Arguments:
02341             pen -- a dictionary with some or all of the below listed keys.
02342             **pendict -- one or more keyword-arguments with the below
02343                          listed keys as keywords.
02344 
02345         Return or set the pen's attributes in a 'pen-dictionary'
02346         with the following key/value pairs:
02347            "shown"      :   True/False
02348            "pendown"    :   True/False
02349            "pencolor"   :   color-string or color-tuple
02350            "fillcolor"  :   color-string or color-tuple
02351            "pensize"    :   positive number
02352            "speed"      :   number in range 0..10
02353            "resizemode" :   "auto" or "user" or "noresize"
02354            "stretchfactor": (positive number, positive number)
02355            "shearfactor":   number
02356            "outline"    :   positive number
02357            "tilt"       :   number
02358 
02359         This dictionary can be used as argument for a subsequent
02360         pen()-call to restore the former pen-state. Moreover one
02361         or more of these attributes can be provided as keyword-arguments.
02362         This can be used to set several pen attributes in one statement.
02363 
02364 
02365         Examples (for a Turtle instance named turtle):
02366         >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10)
02367         >>> turtle.pen()
02368         {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
02369         'pencolor': 'red', 'pendown': True, 'fillcolor': 'black',
02370         'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
02371         >>> penstate=turtle.pen()
02372         >>> turtle.color("yellow","")
02373         >>> turtle.penup()
02374         >>> turtle.pen()
02375         {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
02376         'pencolor': 'yellow', 'pendown': False, 'fillcolor': '',
02377         'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
02378         >>> p.pen(penstate, fillcolor="green")
02379         >>> p.pen()
02380         {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1,
02381         'pencolor': 'red', 'pendown': True, 'fillcolor': 'green',
02382         'stretchfactor': (1,1), 'speed': 3, 'shearfactor': 0.0}
02383         """
02384         _pd =  {"shown"         : self._shown,
02385                 "pendown"       : self._drawing,
02386                 "pencolor"      : self._pencolor,
02387                 "fillcolor"     : self._fillcolor,
02388                 "pensize"       : self._pensize,
02389                 "speed"         : self._speed,
02390                 "resizemode"    : self._resizemode,
02391                 "stretchfactor" : self._stretchfactor,
02392                 "shearfactor"   : self._shearfactor,
02393                 "outline"       : self._outlinewidth,
02394                 "tilt"          : self._tilt
02395                }
02396 
02397         if not (pen or pendict):
02398             return _pd
02399 
02400         if isinstance(pen, dict):
02401             p = pen
02402         else:
02403             p = {}
02404         p.update(pendict)
02405 
02406         _p_buf = {}
02407         for key in p:
02408             _p_buf[key] = _pd[key]
02409 
02410         if self.undobuffer:
02411             self.undobuffer.push(("pen", _p_buf))
02412 
02413         newLine = False
02414         if "pendown" in p:
02415             if self._drawing != p["pendown"]:
02416                 newLine = True
02417         if "pencolor" in p:
02418             if isinstance(p["pencolor"], tuple):
02419                 p["pencolor"] = self._colorstr((p["pencolor"],))
02420             if self._pencolor != p["pencolor"]:
02421                 newLine = True
02422         if "pensize" in p:
02423             if self._pensize != p["pensize"]:
02424                 newLine = True
02425         if newLine:
02426             self._newLine()
02427         if "pendown" in p:
02428             self._drawing = p["pendown"]
02429         if "pencolor" in p:
02430             self._pencolor = p["pencolor"]
02431         if "pensize" in p:
02432             self._pensize = p["pensize"]
02433         if "fillcolor" in p:
02434             if isinstance(p["fillcolor"], tuple):
02435                 p["fillcolor"] = self._colorstr((p["fillcolor"],))
02436             self._fillcolor = p["fillcolor"]
02437         if "speed" in p:
02438             self._speed = p["speed"]
02439         if "resizemode" in p:
02440             self._resizemode = p["resizemode"]
02441         if "stretchfactor" in p:
02442             sf = p["stretchfactor"]
02443             if isinstance(sf, (int, float)):
02444                 sf = (sf, sf)
02445             self._stretchfactor = sf
02446         if "shearfactor" in p:
02447             self._shearfactor = p["shearfactor"]
02448         if "outline" in p:
02449             self._outlinewidth = p["outline"]
02450         if "shown" in p:
02451             self._shown = p["shown"]
02452         if "tilt" in p:
02453             self._tilt = p["tilt"]
02454         if "stretchfactor" in p or "tilt" in p or "shearfactor" in p:
02455             scx, scy = self._stretchfactor
02456             shf = self._shearfactor
02457             sa, ca = math.sin(self._tilt), math.cos(self._tilt)
02458             self._shapetrafo = ( scx*ca, scy*(shf*ca + sa),
02459                                 -scx*sa, scy*(ca - shf*sa))
02460         self._update()

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TPen.pencolor (   self,
  args 
) [inherited]
Return or set the pencolor.

Arguments:
Four input formats are allowed:
  - pencolor()
    Return the current pencolor as color specification string,
    possibly in hex-number format (see example).
    May be used as input to another color/pencolor/fillcolor call.
  - pencolor(colorstring)
    s is a Tk color specification string, such as "red" or "yellow"
  - pencolor((r, g, b))
    *a tuple* of r, g, and b, which represent, an RGB color,
    and each of r, g, and b are in the range 0..colormode,
    where colormode is either 1.0 or 255
  - pencolor(r, g, b)
    r, g, and b represent an RGB color, and each of r, g, and b
    are in the range 0..colormode

If turtleshape is a polygon, the outline of that polygon is drawn
with the newly set pencolor.

Example (for a Turtle instance named turtle):
>>> turtle.pencolor('brown')
>>> tup = (0.2, 0.8, 0.55)
>>> turtle.pencolor(tup)
>>> turtle.pencolor()
'#33cc8c'

Definition at line 2222 of file turtle.py.

02222 
02223     def pencolor(self, *args):
02224         """ Return or set the pencolor.
02225 
02226         Arguments:
02227         Four input formats are allowed:
02228           - pencolor()
02229             Return the current pencolor as color specification string,
02230             possibly in hex-number format (see example).
02231             May be used as input to another color/pencolor/fillcolor call.
02232           - pencolor(colorstring)
02233             s is a Tk color specification string, such as "red" or "yellow"
02234           - pencolor((r, g, b))
02235             *a tuple* of r, g, and b, which represent, an RGB color,
02236             and each of r, g, and b are in the range 0..colormode,
02237             where colormode is either 1.0 or 255
02238           - pencolor(r, g, b)
02239             r, g, and b represent an RGB color, and each of r, g, and b
02240             are in the range 0..colormode
02241 
02242         If turtleshape is a polygon, the outline of that polygon is drawn
02243         with the newly set pencolor.
02244 
02245         Example (for a Turtle instance named turtle):
02246         >>> turtle.pencolor('brown')
02247         >>> tup = (0.2, 0.8, 0.55)
02248         >>> turtle.pencolor(tup)
02249         >>> turtle.pencolor()
02250         '#33cc8c'
02251         """
02252         if args:
02253             color = self._colorstr(args)
02254             if color == self._pencolor:
02255                 return
02256             self.pen(pencolor=color)
02257         else:
02258             return self._color(self._pencolor)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TPen.pendown (   self) [inherited]
Pull the pen down -- drawing when moving.

Aliases: pendown | pd | down

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.pendown()

Definition at line 2109 of file turtle.py.

02109 
02110     def pendown(self):
02111         """Pull the pen down -- drawing when moving.
02112 
02113         Aliases: pendown | pd | down
02114 
02115         No argument.
02116 
02117         Example (for a Turtle instance named turtle):
02118         >>> turtle.pendown()
02119         """
02120         if self._drawing:
02121             return
02122         self.pen(pendown=True)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TPen.pensize (   self,
  width = None 
) [inherited]
Set or return the line thickness.

Aliases:  pensize | width

Argument:
width -- positive number

Set the line thickness to width or return it. If resizemode is set
to "auto" and turtleshape is a polygon, that polygon is drawn with
the same line thickness. If no argument is given, current pensize
is returned.

Example (for a Turtle instance named turtle):
>>> turtle.pensize()
1
turtle.pensize(10)   # from here on lines of width 10 are drawn

Definition at line 2072 of file turtle.py.

02072 
02073     def pensize(self, width=None):
02074         """Set or return the line thickness.
02075 
02076         Aliases:  pensize | width
02077 
02078         Argument:
02079         width -- positive number
02080 
02081         Set the line thickness to width or return it. If resizemode is set
02082         to "auto" and turtleshape is a polygon, that polygon is drawn with
02083         the same line thickness. If no argument is given, current pensize
02084         is returned.
02085 
02086         Example (for a Turtle instance named turtle):
02087         >>> turtle.pensize()
02088         1
02089         turtle.pensize(10)   # from here on lines of width 10 are drawn
02090         """
02091         if width is None:
02092             return self._pensize
02093         self.pen(pensize=width)
02094 

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TPen.penup (   self) [inherited]
Pull the pen up -- no drawing when moving.

Aliases: penup | pu | up

No argument

Example (for a Turtle instance named turtle):
>>> turtle.penup()

Definition at line 2095 of file turtle.py.

02095 
02096     def penup(self):
02097         """Pull the pen up -- no drawing when moving.
02098 
02099         Aliases: penup | pu | up
02100 
02101         No argument
02102 
02103         Example (for a Turtle instance named turtle):
02104         >>> turtle.penup()
02105         """
02106         if not self._drawing:
02107             return
02108         self.pen(pendown=False)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.pos (   self) [inherited]
Return the turtle's current location (x,y), as a Vec2D-vector.

Aliases: pos | position

No arguments.

Example (for a Turtle instance named turtle):
>>> turtle.pos()
(0.00, 240.00)

Definition at line 1701 of file turtle.py.

01701 
01702     def pos(self):
01703         """Return the turtle's current location (x,y), as a Vec2D-vector.
01704 
01705         Aliases: pos | position
01706 
01707         No arguments.
01708 
01709         Example (for a Turtle instance named turtle):
01710         >>> turtle.pos()
01711         (0.00, 240.00)
01712         """
01713         return self._position

Here is the caller graph for this function:

def turtle.TNavigator.radians (   self) [inherited]
Set the angle measurement units to radians.

No arguments.

Example (for a Turtle instance named turtle):
>>> turtle.heading()
90
>>> turtle.radians()
>>> turtle.heading()
1.5707963267948966

Definition at line 1588 of file turtle.py.

01588 
01589     def radians(self):
01590         """ Set the angle measurement units to radians.
01591 
01592         No arguments.
01593 
01594         Example (for a Turtle instance named turtle):
01595         >>> turtle.heading()
01596         90
01597         >>> turtle.radians()
01598         >>> turtle.heading()
01599         1.5707963267948966
01600         """
01601         self._setDegreesPerAU(2*math.pi)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.reset (   self) [inherited]
Delete the turtle's drawings and restore its default values.

No argument.
,
Delete the turtle's drawings from the screen, re-center the turtle
and set variables to the default values.

Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00,-22.00)
>>> turtle.heading()
100.0
>>> turtle.reset()
>>> turtle.position()
(0.00,0.00)
>>> turtle.heading()
0.0

Reimplemented from turtle.TNavigator.

Definition at line 2559 of file turtle.py.

02559 
02560     def reset(self):
02561         """Delete the turtle's drawings and restore its default values.
02562 
02563         No argument.
02564 ,
02565         Delete the turtle's drawings from the screen, re-center the turtle
02566         and set variables to the default values.
02567 
02568         Example (for a Turtle instance named turtle):
02569         >>> turtle.position()
02570         (0.00,-22.00)
02571         >>> turtle.heading()
02572         100.0
02573         >>> turtle.reset()
02574         >>> turtle.position()
02575         (0.00,0.00)
02576         >>> turtle.heading()
02577         0.0
02578         """
02579         TNavigator.reset(self)
02580         TPen._reset(self)
02581         self._clear()
02582         self._drawturtle()
02583         self._update()

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TPen.resizemode (   self,
  rmode = None 
) [inherited]
Set resizemode to one of the values: "auto", "user", "noresize".

(Optional) Argument:
rmode -- one of the strings "auto", "user", "noresize"

Different resizemodes have the following effects:
  - "auto" adapts the appearance of the turtle
   corresponding to the value of pensize.
  - "user" adapts the appearance of the turtle according to the
   values of stretchfactor and outlinewidth (outline),
   which are set by shapesize()
  - "noresize" no adaption of the turtle's appearance takes place.
If no argument is given, return current resizemode.
resizemode("user") is called by a call of shapesize with arguments.


Examples (for a Turtle instance named turtle):
>>> turtle.resizemode("noresize")
>>> turtle.resizemode()
'noresize'

Definition at line 2044 of file turtle.py.

02044 
02045     def resizemode(self, rmode=None):
02046         """Set resizemode to one of the values: "auto", "user", "noresize".
02047 
02048         (Optional) Argument:
02049         rmode -- one of the strings "auto", "user", "noresize"
02050 
02051         Different resizemodes have the following effects:
02052           - "auto" adapts the appearance of the turtle
02053                    corresponding to the value of pensize.
02054           - "user" adapts the appearance of the turtle according to the
02055                    values of stretchfactor and outlinewidth (outline),
02056                    which are set by shapesize()
02057           - "noresize" no adaption of the turtle's appearance takes place.
02058         If no argument is given, return current resizemode.
02059         resizemode("user") is called by a call of shapesize with arguments.
02060 
02061 
02062         Examples (for a Turtle instance named turtle):
02063         >>> turtle.resizemode("noresize")
02064         >>> turtle.resizemode()
02065         'noresize'
02066         """
02067         if rmode is None:
02068             return self._resizemode
02069         rmode = rmode.lower()
02070         if rmode in ["auto", "user", "noresize"]:
02071             self.pen(resizemode=rmode)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.right (   self,
  angle 
) [inherited]
Turn turtle right by angle units.

Aliases: right | rt

Argument:
angle -- a number (integer or float)

Turn turtle right by angle units. (Units are by default degrees,
but can be set via the degrees() and radians() functions.)
Angle orientation depends on mode. (See this.)

Example (for a Turtle instance named turtle):
>>> turtle.heading()
22.0
>>> turtle.right(45)
>>> turtle.heading()
337.0

Definition at line 1659 of file turtle.py.

01659 
01660     def right(self, angle):
01661         """Turn turtle right by angle units.
01662 
01663         Aliases: right | rt
01664 
01665         Argument:
01666         angle -- a number (integer or float)
01667 
01668         Turn turtle right by angle units. (Units are by default degrees,
01669         but can be set via the degrees() and radians() functions.)
01670         Angle orientation depends on mode. (See this.)
01671 
01672         Example (for a Turtle instance named turtle):
01673         >>> turtle.heading()
01674         22.0
01675         >>> turtle.right(45)
01676         >>> turtle.heading()
01677         337.0
01678         """
01679         self._rotate(-angle)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.setheading (   self,
  to_angle 
) [inherited]
Set the orientation of the turtle to to_angle.

Aliases:  setheading | seth

Argument:
to_angle -- a number (integer or float)

Set the orientation of the turtle to to_angle.
Here are some common directions in degrees:

 standard - mode:          logo-mode:
-------------------|--------------------
   0 - east                0 - north
  90 - north              90 - east
 180 - west              180 - south
 270 - south             270 - west

Example (for a Turtle instance named turtle):
>>> turtle.setheading(90)
>>> turtle.heading()
90

Definition at line 1910 of file turtle.py.

01910 
01911     def setheading(self, to_angle):
01912         """Set the orientation of the turtle to to_angle.
01913 
01914         Aliases:  setheading | seth
01915 
01916         Argument:
01917         to_angle -- a number (integer or float)
01918 
01919         Set the orientation of the turtle to to_angle.
01920         Here are some common directions in degrees:
01921 
01922          standard - mode:          logo-mode:
01923         -------------------|--------------------
01924            0 - east                0 - north
01925           90 - north              90 - east
01926          180 - west              180 - south
01927          270 - south             270 - west
01928 
01929         Example (for a Turtle instance named turtle):
01930         >>> turtle.setheading(90)
01931         >>> turtle.heading()
01932         90
01933         """
01934         angle = (to_angle - self.heading())*self._angleOrient
01935         full = self._fullcircle
01936         angle = (angle+full/2.)%full - full/2.
01937         self._rotate(angle)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.settiltangle (   self,
  angle 
) [inherited]
Rotate the turtleshape to point in the specified direction

Argument: angle -- number

Rotate the turtleshape to point in the direction specified by angle,
regardless of its current tilt-angle. DO NOT change the turtle's
heading (direction of movement).


Examples (for a Turtle instance named turtle):
>>> turtle.shape("circle")
>>> turtle.shapesize(5,2)
>>> turtle.settiltangle(45)
>>> stamp()
>>> turtle.fd(50)
>>> turtle.settiltangle(-45)
>>> stamp()
>>> turtle.fd(50)

Definition at line 2843 of file turtle.py.

02843 
02844     def settiltangle(self, angle):
02845         """Rotate the turtleshape to point in the specified direction
02846 
02847         Argument: angle -- number
02848 
02849         Rotate the turtleshape to point in the direction specified by angle,
02850         regardless of its current tilt-angle. DO NOT change the turtle's
02851         heading (direction of movement).
02852 
02853 
02854         Examples (for a Turtle instance named turtle):
02855         >>> turtle.shape("circle")
02856         >>> turtle.shapesize(5,2)
02857         >>> turtle.settiltangle(45)
02858         >>> stamp()
02859         >>> turtle.fd(50)
02860         >>> turtle.settiltangle(-45)
02861         >>> stamp()
02862         >>> turtle.fd(50)
02863         """
02864         tilt = -angle * self._degreesPerAU * self._angleOrient
02865         tilt = (tilt * math.pi / 180.0) % (2*math.pi)
02866         self.pen(resizemode="user", tilt=tilt)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.setundobuffer (   self,
  size 
) [inherited]
Set or disable undobuffer.

Argument:
size -- an integer or None

If size is an integer an empty undobuffer of given size is installed.
Size gives the maximum number of turtle-actions that can be undone
by the undo() function.
If size is None, no undobuffer is present.

Example (for a Turtle instance named turtle):
>>> turtle.setundobuffer(42)

Definition at line 2584 of file turtle.py.

02584 
02585     def setundobuffer(self, size):
02586         """Set or disable undobuffer.
02587 
02588         Argument:
02589         size -- an integer or None
02590 
02591         If size is an integer an empty undobuffer of given size is installed.
02592         Size gives the maximum number of turtle-actions that can be undone
02593         by the undo() function.
02594         If size is None, no undobuffer is present.
02595 
02596         Example (for a Turtle instance named turtle):
02597         >>> turtle.setundobuffer(42)
02598         """
02599         if size is None:
02600             self.undobuffer = None
02601         else:
02602             self.undobuffer = Tbuffer(size)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.setx (   self,
  x 
) [inherited]
Set the turtle's first coordinate to x

Argument:
x -- a number (integer or float)

Set the turtle's first coordinate to x, leave second coordinate
unchanged.

Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00, 240.00)
>>> turtle.setx(10)
>>> turtle.position()
(10.00, 240.00)

Definition at line 1792 of file turtle.py.

01792 
01793     def setx(self, x):
01794         """Set the turtle's first coordinate to x
01795 
01796         Argument:
01797         x -- a number (integer or float)
01798 
01799         Set the turtle's first coordinate to x, leave second coordinate
01800         unchanged.
01801 
01802         Example (for a Turtle instance named turtle):
01803         >>> turtle.position()
01804         (0.00, 240.00)
01805         >>> turtle.setx(10)
01806         >>> turtle.position()
01807         (10.00, 240.00)
01808         """
01809         self._goto(Vec2D(x, self._position[1]))

Here is the call graph for this function:

def turtle.TNavigator.sety (   self,
  y 
) [inherited]
Set the turtle's second coordinate to y

Argument:
y -- a number (integer or float)

Set the turtle's first coordinate to x, second coordinate remains
unchanged.

Example (for a Turtle instance named turtle):
>>> turtle.position()
(0.00, 40.00)
>>> turtle.sety(-10)
>>> turtle.position()
(0.00, -10.00)

Definition at line 1810 of file turtle.py.

01810 
01811     def sety(self, y):
01812         """Set the turtle's second coordinate to y
01813 
01814         Argument:
01815         y -- a number (integer or float)
01816 
01817         Set the turtle's first coordinate to x, second coordinate remains
01818         unchanged.
01819 
01820         Example (for a Turtle instance named turtle):
01821         >>> turtle.position()
01822         (0.00, 40.00)
01823         >>> turtle.sety(-10)
01824         >>> turtle.position()
01825         (0.00, -10.00)
01826         """
01827         self._goto(Vec2D(self._position[0], y))

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.shape (   self,
  name = None 
) [inherited]
Set turtle shape to shape with given name / return current shapename.

Optional argument:
name -- a string, which is a valid shapename

Set turtle shape to shape with given name or, if name is not given,
return name of current shape.
Shape with name must exist in the TurtleScreen's shape dictionary.
Initially there are the following polygon shapes:
'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
To learn about how to deal with shapes see Screen-method register_shape.

Example (for a Turtle instance named turtle):
>>> turtle.shape()
'arrow'
>>> turtle.shape("turtle")
>>> turtle.shape()
'turtle'

Definition at line 2753 of file turtle.py.

02753 
02754     def shape(self, name=None):
02755         """Set turtle shape to shape with given name / return current shapename.
02756 
02757         Optional argument:
02758         name -- a string, which is a valid shapename
02759 
02760         Set turtle shape to shape with given name or, if name is not given,
02761         return name of current shape.
02762         Shape with name must exist in the TurtleScreen's shape dictionary.
02763         Initially there are the following polygon shapes:
02764         'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'.
02765         To learn about how to deal with shapes see Screen-method register_shape.
02766 
02767         Example (for a Turtle instance named turtle):
02768         >>> turtle.shape()
02769         'arrow'
02770         >>> turtle.shape("turtle")
02771         >>> turtle.shape()
02772         'turtle'
02773         """
02774         if name is None:
02775             return self.turtle.shapeIndex
02776         if not name in self.screen.getshapes():
02777             raise TurtleGraphicsError("There is no shape named %s" % name)
02778         self.turtle._setshape(name)
02779         self._update()

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.shapesize (   self,
  stretch_wid = None,
  stretch_len = None,
  outline = None 
) [inherited]
Set/return turtle's stretchfactors/outline. Set resizemode to "user".

Optinonal arguments:
   stretch_wid : positive number
   stretch_len : positive number
   outline  : positive number

Return or set the pen's attributes x/y-stretchfactors and/or outline.
Set resizemode to "user".
If and only if resizemode is set to "user", the turtle will be displayed
stretched according to its stretchfactors:
stretch_wid is stretchfactor perpendicular to orientation
stretch_len is stretchfactor in direction of turtles orientation.
outline determines the width of the shapes's outline.

Examples (for a Turtle instance named turtle):
>>> turtle.resizemode("user")
>>> turtle.shapesize(5, 5, 12)
>>> turtle.shapesize(outline=8)

Definition at line 2780 of file turtle.py.

02780 
02781     def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
02782         """Set/return turtle's stretchfactors/outline. Set resizemode to "user".
02783 
02784         Optinonal arguments:
02785            stretch_wid : positive number
02786            stretch_len : positive number
02787            outline  : positive number
02788 
02789         Return or set the pen's attributes x/y-stretchfactors and/or outline.
02790         Set resizemode to "user".
02791         If and only if resizemode is set to "user", the turtle will be displayed
02792         stretched according to its stretchfactors:
02793         stretch_wid is stretchfactor perpendicular to orientation
02794         stretch_len is stretchfactor in direction of turtles orientation.
02795         outline determines the width of the shapes's outline.
02796 
02797         Examples (for a Turtle instance named turtle):
02798         >>> turtle.resizemode("user")
02799         >>> turtle.shapesize(5, 5, 12)
02800         >>> turtle.shapesize(outline=8)
02801         """
02802         if stretch_wid is stretch_len is outline is None:
02803             stretch_wid, stretch_len = self._stretchfactor
02804             return stretch_wid, stretch_len, self._outlinewidth
02805         if stretch_wid == 0 or stretch_len == 0:
02806             raise TurtleGraphicsError("stretch_wid/stretch_len must not be zero")
02807         if stretch_wid is not None:
02808             if stretch_len is None:
02809                 stretchfactor = stretch_wid, stretch_wid
02810             else:
02811                 stretchfactor = stretch_wid, stretch_len
02812         elif stretch_len is not None:
02813             stretchfactor = self._stretchfactor[0], stretch_len
02814         else:
02815             stretchfactor = self._stretchfactor
02816         if outline is None:
02817             outline = self._outlinewidth
02818         self.pen(resizemode="user",
02819                  stretchfactor=stretchfactor, outline=outline)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.shapetransform (   self,
  t11 = None,
  t12 = None,
  t21 = None,
  t22 = None 
) [inherited]
Set or return the current transformation matrix of the turtle shape.

Optional arguments: t11, t12, t21, t22 -- numbers.

If none of the matrix elements are given, return the transformation
matrix.
Otherwise set the given elements and transform the turtleshape
according to the matrix consisting of first row t11, t12 and
second row t21, 22.
Modify stretchfactor, shearfactor and tiltangle according to the
given matrix.

Examples (for a Turtle instance named turtle):
>>> turtle.shape("square")
>>> turtle.shapesize(4,2)
>>> turtle.shearfactor(-0.5)
>>> turtle.shapetransform()
>>> (4.0, -1.0, -0.0, 2.0)

Definition at line 2913 of file turtle.py.

02913 
02914     def shapetransform(self, t11=None, t12=None, t21=None, t22=None):
02915         """Set or return the current transformation matrix of the turtle shape.
02916 
02917         Optional arguments: t11, t12, t21, t22 -- numbers.
02918 
02919         If none of the matrix elements are given, return the transformation
02920         matrix.
02921         Otherwise set the given elements and transform the turtleshape
02922         according to the matrix consisting of first row t11, t12 and
02923         second row t21, 22.
02924         Modify stretchfactor, shearfactor and tiltangle according to the
02925         given matrix.
02926 
02927         Examples (for a Turtle instance named turtle):
02928         >>> turtle.shape("square")
02929         >>> turtle.shapesize(4,2)
02930         >>> turtle.shearfactor(-0.5)
02931         >>> turtle.shapetransform()
02932         >>> (4.0, -1.0, -0.0, 2.0)
02933         """
02934         if t11 is t12 is t21 is t22 is None:
02935             return self._shapetrafo
02936         m11, m12, m21, m22 = self._shapetrafo
02937         if t11 is not None: m11 = t11
02938         if t12 is not None: m12 = t12
02939         if t21 is not None: m21 = t21
02940         if t22 is not None: m22 = t22
02941         if t11 * t22 - t12 * t21 == 0:
02942             raise TurtleGraphicsError("Bad shape transform matrix: must not be singular")
02943         self._shapetrafo = (m11, m12, m21, m22)
02944         alfa = math.atan2(-m21, m11) % (2 * math.pi)
02945         sa, ca = math.sin(alfa), math.cos(alfa)
02946         a11, a12, a21, a22 = (ca*m11 - sa*m21, ca*m12 - sa*m22,
02947                               sa*m11 + ca*m21, sa*m12 + ca*m22)
02948         self._stretchfactor = a11, a22
02949         self._shearfactor = a12/a22
02950         self._tilt = alfa
02951         self._update()
02952 

def turtle.RawTurtle.shearfactor (   self,
  shear = None 
) [inherited]
Set or return the current shearfactor.

Optional argument: shear -- number, tangent of the shear angle

Shear the turtleshape according to the given shearfactor shear,
which is the tangent of the shear angle. DO NOT change the
turtle's heading (direction of movement).
If shear is not given: return the current shearfactor, i. e. the
tangent of the shear angle, by which lines parallel to the
heading of the turtle are sheared.

Examples (for a Turtle instance named turtle):
>>> turtle.shape("circle")
>>> turtle.shapesize(5,2)
>>> turtle.shearfactor(0.5)
>>> turtle.shearfactor()
>>> 0.5

Definition at line 2820 of file turtle.py.

02820 
02821     def shearfactor(self, shear=None):
02822         """Set or return the current shearfactor.
02823 
02824         Optional argument: shear -- number, tangent of the shear angle
02825 
02826         Shear the turtleshape according to the given shearfactor shear,
02827         which is the tangent of the shear angle. DO NOT change the
02828         turtle's heading (direction of movement).
02829         If shear is not given: return the current shearfactor, i. e. the
02830         tangent of the shear angle, by which lines parallel to the
02831         heading of the turtle are sheared.
02832 
02833         Examples (for a Turtle instance named turtle):
02834         >>> turtle.shape("circle")
02835         >>> turtle.shapesize(5,2)
02836         >>> turtle.shearfactor(0.5)
02837         >>> turtle.shearfactor()
02838         >>> 0.5
02839         """
02840         if shear is None:
02841             return self._shearfactor
02842         self.pen(resizemode="user", shearfactor=shear)

Here is the call graph for this function:

def turtle.TPen.showturtle (   self) [inherited]
Makes the turtle visible.

Aliases: showturtle | st

No argument.

Example (for a Turtle instance named turtle):
>>> turtle.hideturtle()
>>> turtle.showturtle()

Definition at line 2295 of file turtle.py.

02295 
02296     def showturtle(self):
02297         """Makes the turtle visible.
02298 
02299         Aliases: showturtle | st
02300 
02301         No argument.
02302 
02303         Example (for a Turtle instance named turtle):
02304         >>> turtle.hideturtle()
02305         >>> turtle.showturtle()
02306         """
02307         self.pen(shown=True)

Here is the call graph for this function:

def turtle.TPen.speed (   self,
  speed = None 
) [inherited]
Return or set the turtle's speed.

Optional argument:
speed -- an integer in the range 0..10 or a speedstring (see below)

Set the turtle's speed to an integer value in the range 0 .. 10.
If no argument is given: return current speed.

If input is a number greater than 10 or smaller than 0.5,
speed is set to 0.
Speedstrings  are mapped to speedvalues in the following way:
    'fastest' :  0
    'fast'    :  10
    'normal'  :  6
    'slow'    :  3
    'slowest' :  1
speeds from 1 to 10 enforce increasingly faster animation of
line drawing and turtle turning.

Attention:
speed = 0 : *no* animation takes place. forward/back makes turtle jump
and likewise left/right make the turtle turn instantly.

Example (for a Turtle instance named turtle):
>>> turtle.speed(3)

Definition at line 2138 of file turtle.py.

02138 
02139     def speed(self, speed=None):
02140         """ Return or set the turtle's speed.
02141 
02142         Optional argument:
02143         speed -- an integer in the range 0..10 or a speedstring (see below)
02144 
02145         Set the turtle's speed to an integer value in the range 0 .. 10.
02146         If no argument is given: return current speed.
02147 
02148         If input is a number greater than 10 or smaller than 0.5,
02149         speed is set to 0.
02150         Speedstrings  are mapped to speedvalues in the following way:
02151             'fastest' :  0
02152             'fast'    :  10
02153             'normal'  :  6
02154             'slow'    :  3
02155             'slowest' :  1
02156         speeds from 1 to 10 enforce increasingly faster animation of
02157         line drawing and turtle turning.
02158 
02159         Attention:
02160         speed = 0 : *no* animation takes place. forward/back makes turtle jump
02161         and likewise left/right make the turtle turn instantly.
02162 
02163         Example (for a Turtle instance named turtle):
02164         >>> turtle.speed(3)
02165         """
02166         speeds = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 }
02167         if speed is None:
02168             return self._speed
02169         if speed in speeds:
02170             speed = speeds[speed]
02171         elif 0.5 < speed < 10.5:
02172             speed = int(round(speed))
02173         else:
02174             speed = 0
02175         self.pen(speed=speed)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.stamp (   self) [inherited]

stamp stuff ###############################

Stamp a copy of the turtleshape onto the canvas and return its id.

No argument.

Stamp a copy of the turtle shape onto the canvas at the current
turtle position. Return a stamp_id for that stamp, which can be
used to delete it by calling clearstamp(stamp_id).

Example (for a Turtle instance named turtle):
>>> turtle.color("blue")
>>> turtle.stamp()
13
>>> turtle.fd(50)

Definition at line 3035 of file turtle.py.

03035 
03036     def stamp(self):
03037         """Stamp a copy of the turtleshape onto the canvas and return its id.
03038 
03039         No argument.
03040 
03041         Stamp a copy of the turtle shape onto the canvas at the current
03042         turtle position. Return a stamp_id for that stamp, which can be
03043         used to delete it by calling clearstamp(stamp_id).
03044 
03045         Example (for a Turtle instance named turtle):
03046         >>> turtle.color("blue")
03047         >>> turtle.stamp()
03048         13
03049         >>> turtle.fd(50)
03050         """
03051         screen = self.screen
03052         shape = screen._shapes[self.turtle.shapeIndex]
03053         ttype = shape._type
03054         tshape = shape._data
03055         if ttype == "polygon":
03056             stitem = screen._createpoly()
03057             if self._resizemode == "noresize": w = 1
03058             elif self._resizemode == "auto": w = self._pensize
03059             else: w =self._outlinewidth
03060             shape = self._polytrafo(self._getshapepoly(tshape))
03061             fc, oc = self._fillcolor, self._pencolor
03062             screen._drawpoly(stitem, shape, fill=fc, outline=oc,
03063                                                   width=w, top=True)
03064         elif ttype == "image":
03065             stitem = screen._createimage("")
03066             screen._drawimage(stitem, self._position, tshape)
03067         elif ttype == "compound":
03068             stitem = []
03069             for element in tshape:
03070                 item = screen._createpoly()
03071                 stitem.append(item)
03072             stitem = tuple(stitem)
03073             for item, (poly, fc, oc) in zip(stitem, tshape):
03074                 poly = self._polytrafo(self._getshapepoly(poly, True))
03075                 screen._drawpoly(item, poly, fill=self._cc(fc),
03076                                  outline=self._cc(oc), width=self._outlinewidth, top=True)
03077         self.stampItems.append(stitem)
03078         self.undobuffer.push(("stamp", stitem))
03079         return stitem

Here is the call graph for this function:

def turtle.RawTurtle.tilt (   self,
  angle 
) [inherited]
Rotate the turtleshape by angle.

Argument:
angle - a number

Rotate the turtleshape by angle from its current tilt-angle,
but do NOT change the turtle's heading (direction of movement).

Examples (for a Turtle instance named turtle):
>>> turtle.shape("circle")
>>> turtle.shapesize(5,2)
>>> turtle.tilt(30)
>>> turtle.fd(50)
>>> turtle.tilt(30)
>>> turtle.fd(50)

Definition at line 2894 of file turtle.py.

02894 
02895     def tilt(self, angle):
02896         """Rotate the turtleshape by angle.
02897 
02898         Argument:
02899         angle - a number
02900 
02901         Rotate the turtleshape by angle from its current tilt-angle,
02902         but do NOT change the turtle's heading (direction of movement).
02903 
02904         Examples (for a Turtle instance named turtle):
02905         >>> turtle.shape("circle")
02906         >>> turtle.shapesize(5,2)
02907         >>> turtle.tilt(30)
02908         >>> turtle.fd(50)
02909         >>> turtle.tilt(30)
02910         >>> turtle.fd(50)
02911         """
02912         self.settiltangle(angle + self.tiltangle())

Here is the call graph for this function:

def turtle.RawTurtle.tiltangle (   self,
  angle = None 
) [inherited]
Set or return the current tilt-angle.

Optional argument: angle -- number

Rotate the turtleshape to point in the direction specified by angle,
regardless of its current tilt-angle. DO NOT change the turtle's
heading (direction of movement).
If angle is not given: return the current tilt-angle, i. e. the angle
between the orientation of the turtleshape and the heading of the
turtle (its direction of movement).

Deprecated since Python 3.1

Examples (for a Turtle instance named turtle):
>>> turtle.shape("circle")
>>> turtle.shapesize(5,2)
>>> turtle.tilt(45)
>>> turtle.tiltangle()
>>>

Definition at line 2867 of file turtle.py.

02867 
02868     def tiltangle(self, angle=None):
02869         """Set or return the current tilt-angle.
02870 
02871         Optional argument: angle -- number
02872 
02873         Rotate the turtleshape to point in the direction specified by angle,
02874         regardless of its current tilt-angle. DO NOT change the turtle's
02875         heading (direction of movement).
02876         If angle is not given: return the current tilt-angle, i. e. the angle
02877         between the orientation of the turtleshape and the heading of the
02878         turtle (its direction of movement).
02879 
02880         Deprecated since Python 3.1
02881 
02882         Examples (for a Turtle instance named turtle):
02883         >>> turtle.shape("circle")
02884         >>> turtle.shapesize(5,2)
02885         >>> turtle.tilt(45)
02886         >>> turtle.tiltangle()
02887         >>>
02888         """
02889         if angle is None:
02890             tilt = -self._tilt * (180.0/math.pi) * self._angleOrient
02891             return (tilt / self._degreesPerAU) % self._fullcircle
02892         else:
02893             self.settiltangle(angle)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.TNavigator.towards (   self,
  x,
  y = None 
) [inherited]
Return the angle of the line from the turtle's position to (x, y).

Arguments:
x -- a number   or  a pair/vector of numbers   or   a turtle instance
y -- a number       None                            None

call: distance(x, y)         # two coordinates
--or: distance((x, y))       # a pair (tuple) of coordinates
--or: distance(vec)          # e.g. as returned by pos()
--or: distance(mypen)        # where mypen is another turtle

Return the angle, between the line from turtle-position to position
specified by x, y and the turtle's start orientation. (Depends on
modes - "standard" or "logo")

Example (for a Turtle instance named turtle):
>>> turtle.pos()
(10.00, 10.00)
>>> turtle.towards(0,0)
225.0

Definition at line 1860 of file turtle.py.

01860 
01861     def towards(self, x, y=None):
01862         """Return the angle of the line from the turtle's position to (x, y).
01863 
01864         Arguments:
01865         x -- a number   or  a pair/vector of numbers   or   a turtle instance
01866         y -- a number       None                            None
01867 
01868         call: distance(x, y)         # two coordinates
01869         --or: distance((x, y))       # a pair (tuple) of coordinates
01870         --or: distance(vec)          # e.g. as returned by pos()
01871         --or: distance(mypen)        # where mypen is another turtle
01872 
01873         Return the angle, between the line from turtle-position to position
01874         specified by x, y and the turtle's start orientation. (Depends on
01875         modes - "standard" or "logo")
01876 
01877         Example (for a Turtle instance named turtle):
01878         >>> turtle.pos()
01879         (10.00, 10.00)
01880         >>> turtle.towards(0,0)
01881         225.0
01882         """
01883         if y is not None:
01884             pos = Vec2D(x, y)
01885         if isinstance(x, Vec2D):
01886             pos = x
01887         elif isinstance(x, tuple):
01888             pos = Vec2D(*x)
01889         elif isinstance(x, TNavigator):
01890             pos = x._position
01891         x, y = pos - self._position
01892         result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0
01893         result /= self._degreesPerAU
01894         return (self._angleOffset + self._angleOrient*result) % self._fullcircle

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.undo (   self) [inherited]
undo (repeatedly) the last turtle action.

No argument.

undo (repeatedly) the last turtle action.
Number of available undo actions is determined by the size of
the undobuffer.

Example (for a Turtle instance named turtle):
>>> for i in range(4):
turtle.fd(50); turtle.lt(80)

>>> for i in range(8):
turtle.undo()

Definition at line 3622 of file turtle.py.

03622 
03623     def undo(self):
03624         """undo (repeatedly) the last turtle action.
03625 
03626         No argument.
03627 
03628         undo (repeatedly) the last turtle action.
03629         Number of available undo actions is determined by the size of
03630         the undobuffer.
03631 
03632         Example (for a Turtle instance named turtle):
03633         >>> for i in range(4):
03634                 turtle.fd(50); turtle.lt(80)
03635 
03636         >>> for i in range(8):
03637                 turtle.undo()
03638         """
03639         if self.undobuffer is None:
03640             return
03641         item = self.undobuffer.pop()
03642         action = item[0]
03643         data = item[1:]
03644         if action == "seq":
03645             while data:
03646                 item = data.pop()
03647                 self._undo(item[0], item[1:])
03648         else:
03649             self._undo(action, data)

Here is the call graph for this function:

Here is the caller graph for this function:

def turtle.RawTurtle.undobufferentries (   self) [inherited]
Return count of entries in the undobuffer.

No argument.

Example (for a Turtle instance named turtle):
>>> while undobufferentries():
undo()

Definition at line 2603 of file turtle.py.

02603 
02604     def undobufferentries(self):
02605         """Return count of entries in the undobuffer.
02606 
02607         No argument.
02608 
02609         Example (for a Turtle instance named turtle):
02610         >>> while undobufferentries():
02611                 undo()
02612         """
02613         if self.undobuffer is None:
02614             return 0
02615         return self.undobuffer.nr_of_items()

Here is the call graph for this function:

def turtle.RawTurtle.write (   self,
  arg,
  move = False,
  align = "left",
  font = ("Arial", 8,
  normal 
) [inherited]
Write text at the current turtle position.

Arguments:
arg -- info, which is to be written to the TurtleScreen
move (optional) -- True/False
align (optional) -- one of the strings "left", "center" or right"
font (optional) -- a triple (fontname, fontsize, fonttype)

Write text - the string representation of arg - at the current
turtle position according to align ("left", "center" or right")
and with the given font.
If move is True, the pen is moved to the bottom-right corner
of the text. By default, move is False.

Example (for a Turtle instance named turtle):
>>> turtle.write('Home = ', True, align="center")
>>> turtle.write((0,0), True)

Definition at line 3410 of file turtle.py.

03410 
03411     def write(self, arg, move=False, align="left", font=("Arial", 8, "normal")):
03412         """Write text at the current turtle position.
03413 
03414         Arguments:
03415         arg -- info, which is to be written to the TurtleScreen
03416         move (optional) -- True/False
03417         align (optional) -- one of the strings "left", "center" or right"
03418         font (optional) -- a triple (fontname, fontsize, fonttype)
03419 
03420         Write text - the string representation of arg - at the current
03421         turtle position according to align ("left", "center" or right")
03422         and with the given font.
03423         If move is True, the pen is moved to the bottom-right corner
03424         of the text. By default, move is False.
03425 
03426         Example (for a Turtle instance named turtle):
03427         >>> turtle.write('Home = ', True, align="center")
03428         >>> turtle.write((0,0), True)
03429         """
03430         if self.undobuffer:
03431             self.undobuffer.push(["seq"])
03432             self.undobuffer.cumulate = True
03433         end = self._write(str(arg), align.lower(), font)
03434         if move:
03435             x, y = self.pos()
03436             self.setpos(end, y)
03437         if self.undobuffer:
03438             self.undobuffer.cumulate = False

Here is the call graph for this function:

def turtle.TNavigator.xcor (   self) [inherited]
Return the turtle's x coordinate.

No arguments.

Example (for a Turtle instance named turtle):
>>> reset()
>>> turtle.left(60)
>>> turtle.forward(100)
>>> print turtle.xcor()
50.0

Definition at line 1714 of file turtle.py.

01714 
01715     def xcor(self):
01716         """ Return the turtle's x coordinate.
01717 
01718         No arguments.
01719 
01720         Example (for a Turtle instance named turtle):
01721         >>> reset()
01722         >>> turtle.left(60)
01723         >>> turtle.forward(100)
01724         >>> print turtle.xcor()
01725         50.0
01726         """
01727         return self._position[0]

Here is the call graph for this function:

def turtle.TNavigator.ycor (   self) [inherited]
Return the turtle's y coordinate
---
No arguments.

Example (for a Turtle instance named turtle):
>>> reset()
>>> turtle.left(60)
>>> turtle.forward(100)
>>> print turtle.ycor()
86.6025403784

Definition at line 1728 of file turtle.py.

01728 
01729     def ycor(self):
01730         """ Return the turtle's y coordinate
01731         ---
01732         No arguments.
01733 
01734         Example (for a Turtle instance named turtle):
01735         >>> reset()
01736         >>> turtle.left(60)
01737         >>> turtle.forward(100)
01738         >>> print turtle.ycor()
01739         86.6025403784
01740         """
01741         return self._position[1]
01742 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 93 of file nim.py.

Definition at line 2552 of file turtle.py.

Definition at line 2551 of file turtle.py.

int turtle.TNavigator.DEFAULT_ANGLEOFFSET = 0 [static, inherited]

Definition at line 1519 of file turtle.py.

int turtle.TNavigator.DEFAULT_ANGLEORIENT = 1 [static, inherited]

Definition at line 1520 of file turtle.py.

string turtle.TNavigator.DEFAULT_MODE = "standard" [static, inherited]

Definition at line 1518 of file turtle.py.

Definition at line 2544 of file turtle.py.

Definition at line 94 of file nim.py.

turtle.RawTurtle.getpen = getturtle [static, inherited]

Definition at line 3512 of file turtle.py.

Definition at line 2553 of file turtle.py.

Definition at line 107 of file object.h.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 92 of file nim.py.

Definition at line 2524 of file turtle.py.

list turtle.RawTurtle.screens = [] [static, inherited]

Definition at line 2517 of file turtle.py.

Definition at line 2554 of file turtle.py.

Initial value:
{
        "standard": Vec2D(1.0, 0.0),
        "world"   : Vec2D(1.0, 0.0),
        "logo"    : Vec2D(0.0, 1.0)  }

Definition at line 1514 of file turtle.py.

Definition at line 2545 of file turtle.py.

turtle.RawTurtle.turtlesize = shapesize [static, inherited]

Definition at line 3650 of file turtle.py.

Reimplemented from turtle.TNavigator.

Definition at line 2556 of file turtle.py.


The documentation for this class was generated from the following file: