turtle.RawTurtle

class turtle.RawTurtle(canvas=None, shape='classic', undobuffersize=1000, visible=True)[source]

Animation part of the RawTurtle. Puts RawTurtle upon a TurtleScreen and provides tools for its animation.

Methods

__format__ default object formatter
__init__([canvas, shape, undobuffersize, ...])
__new__((S, ...)
__reduce__ helper for pickle
__reduce_ex__ helper for pickle
__sizeof__(() -> int) size of object in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().
_cc(args) Convert colortriples to hexstrings.
_clear() Delete all of pen’s drawings
_clearstamp(stampid) does the work for clearstamp() and clearstamps()
_color(args)
_colorstr(args)
_delay([delay]) Set delay value which determines speed of turtle animation.
_drawturtle() Manages the correct rendering of the turtle with respect to its shape, resizemode, stretch and tilt etc.
_go(distance) move turtle forward by specified distance
_goto(end) Move the pen to the point end, thereby drawing a line if pen is down.
_newLine([usePos]) Closes current line item and starts a new one.
_polytrafo(poly) Computes transformed polygon shapes from a shape according to current position and heading.
_reset([pencolor, fillcolor])
_rotate(angle) Turns pen clockwise by angle.
_setDegreesPerAU(fullcircle) Helper function for degrees() and radians()
_setmode([mode]) Set turtle-mode to ‘standard’, ‘world’ or ‘logo’.
_undo(action, data) Does the main part of the work for undo()
_undogoto(entry) Reverse a _goto.
_update() Perform a Turtle-data update.
_update_data()
_write(txt, align, font) Performs the writing for write()
back(distance) Move the turtle backward by distance.
backward(distance) Move the turtle backward by distance.
begin_fill() Called just before drawing a shape to be filled.
begin_poly() Start recording the vertices of a polygon.
bk(distance) Move the turtle backward by distance.
circle(radius[, extent, steps]) Draw a circle with given radius.
clear() Delete the turtle’s drawings from the screen.
clearstamp(stampid) Delete stamp with given stampid
clearstamps([n]) Delete all or first/last n of turtle’s stamps.
clone() Create and return a clone of the turtle.
color(*args) Return or set the pencolor and fillcolor.
degrees([fullcircle]) Set angle measurement units to degrees.
distance(x[, y]) Return the distance from the turtle to (x,y) in turtle step units.
dot([size]) Draw a dot with diameter size, using color.
down() Pull the pen down – drawing when moving.
end_fill() Fill the shape drawn after the call begin_fill().
end_poly() Stop recording the vertices of a polygon.
fd(distance) Move the turtle forward by the specified distance.
fill([flag]) Call fill(True) before drawing a shape to fill, fill(False) when done.
fillcolor(*args) Return or set the fillcolor.
forward(distance) Move the turtle forward by the specified distance.
get_poly() Return the lastly recorded polygon.
getpen() Return the Turtleobject itself.
getscreen() Return the TurtleScreen object, the turtle is drawing on.
getturtle() Return the Turtleobject itself.
goto(x[, y]) Move turtle to an absolute position.
heading() Return the turtle’s current heading.
hideturtle() Makes the turtle invisible.
home() Move turtle to the origin - coordinates (0,0).
ht() Makes the turtle invisible.
isdown() Return True if pen is down, False if it’s up.
isvisible() Return True if the Turtle is shown, False if it’s hidden.
left(angle) Turn turtle left by angle units.
lt(angle) Turn turtle left by angle units.
onclick(fun[, btn, add]) Bind fun to mouse-click event on this turtle on canvas.
ondrag(fun[, btn, add]) Bind fun to mouse-move event on this turtle on canvas.
onrelease(fun[, btn, add]) Bind fun to mouse-button-release event on this turtle on canvas.
pd() Pull the pen down – drawing when moving.
pen([pen]) Return or set the pen’s attributes.
pencolor(*args) Return or set the pencolor.
pendown() Pull the pen down – drawing when moving.
pensize([width]) Set or return the line thickness.
penup() Pull the pen up – no drawing when moving.
pos() Return the turtle’s current location (x,y), as a Vec2D-vector.
position() Return the turtle’s current location (x,y), as a Vec2D-vector.
pu() Pull the pen up – no drawing when moving.
radians() Set the angle measurement units to radians.
reset() Delete the turtle’s drawings and restore its default values.
resizemode([rmode]) Set resizemode to one of the values: “auto”, “user”, “noresize”.
right(angle) Turn turtle right by angle units.
rt(angle) Turn turtle right by angle units.
seth(to_angle) Set the orientation of the turtle to to_angle.
setheading(to_angle) Set the orientation of the turtle to to_angle.
setpos(x[, y]) Move turtle to an absolute position.
setposition(x[, y]) Move turtle to an absolute position.
settiltangle(angle) Rotate the turtleshape to point in the specified direction
setundobuffer(size) Set or disable undobuffer.
setx(x) Set the turtle’s first coordinate to x
sety(y) Set the turtle’s second coordinate to y
shape([name]) Set turtle shape to shape with given name / return current shapename.
shapesize([stretch_wid, stretch_len, outline]) Set/return turtle’s stretchfactors/outline.
showturtle() Makes the turtle visible.
speed([speed]) Return or set the turtle’s speed.
st() Makes the turtle visible.
stamp() Stamp a copy of the turtleshape onto the canvas and return its id.
tilt(angle) Rotate the turtleshape by angle.
tiltangle() Return the current tilt-angle.
towards(x[, y]) Return the angle of the line from the turtle’s position to (x, y).
tracer([flag, delay]) Turns turtle animation on/off and set delay for update drawings.
turtlesize([stretch_wid, stretch_len, outline]) Set/return turtle’s stretchfactors/outline.
undo() undo (repeatedly) the last turtle action.
undobufferentries() Return count of entries in the undobuffer.
up() Pull the pen up – no drawing when moving.
width([width]) Set or return the line thickness.
window_height() Return the height of the turtle window.
window_width() Returns the width of the turtle window.
write(arg[, move, align, font]) Write text at the current turtle position.
xcor() Return the turtle’s x coordinate.
ycor() Return the turtle’s y coordinate — No arguments.