Package pygsear :: Module Drawable :: Class EuclidTurtle
[show private | hide private]
[frames | no frames]

Class EuclidTurtle

object --+                    
         |                    
    Sprite --+                
             |                
      Drawable --+            
                 |            
        MultiImage --+        
                     |        
          RotatedImage --+    
                         |    
                    Turtle --+
                             |
                            EuclidTurtle


Turtle with altered co-ordinate system.

Instead of (0, 0) being the upper left corner of the screen, the origin is the center of the screen. The EuclidTurtle also uses a different scale: each unit is by default 30 pixels.
Method Summary
  __init__(self, w, position, deg, color, filename, colorkey, convert)
a new object with type S, a subtype of T __new__(S, ...)
  __repr__(self)
(inherited from Sprite)
  add(self, group)
add(group) add a sprite to container (inherited from Sprite)
  add_internal(self, group)
(inherited from Sprite)
  addImage(self, filename, image, colorkey, convert)
add image to list of available images (inherited from MultiImage)
  alive(self)
alive() -> bool ask the life of a sprite (inherited from Sprite)
  backward(self, dist)
Move the turtle backward distance. (inherited from Turtle)
  begin(self, interactive)
Start a new layer for drawing. (inherited from Turtle)
  begin_fill(self)
Start saving points for filling a polygon later (inherited from Turtle)
  blink(self, times, delay)
Flash the turtle on and off. (inherited from Turtle)
bool can_see(self, target, blocking_rects_list)
Performs a los (line of sight) check from the center of the source to the center of the target. (inherited from Drawable)
  cCircle(self, radius, color, width)
Quick drawing circle, centered on current position.
  center(self, x, y, dx, dy)
Align the Drawable in its layer (inherited from Drawable)
  circle(self, radius, clockwise, color, width)
Quick drawing circle.
  clear(self, surface)
erase sprite image to background, returning affected rect (inherited from Turtle)
  clearScreen(self)
Clear the screen to BLACK (inherited from Turtle)
bool collide(self, other)
return True if this sprite and other sprite overlap. (inherited from Drawable)
Drawable or False collidelist(self, lothers)
return True if this sprite and any in list of others collide. (inherited from Drawable)
List collidelistall(self, lothers)
return True if this sprite and any in list of others collide. (inherited from Drawable)
  commit(self)
Copy drawing layer to base window. (inherited from Turtle)
  commit_fill(self, color)
Fill the polygon of saved points (inherited from Turtle)
  cRectangle(self, side_length, side_width, width, color, bgColor)
Quick drawing routine for rectangles.
  cSquare(self, side_length, width, color, bgColor)
Quick drawing routine for squares.
  direction(self, point)
return the direction from the sprite to a point (inherited from Drawable)
  distance(self, point)
return the distance from the sprite to a point (inherited from Drawable)
  draw(self, surface)
draw image, returning affected rect (inherited from Turtle)
  drawEuclidCoords(self)
Draw the cartesian (x, y) coordinate system.
  euclid_scale(self, dist)
Scale a distance to a real screen distance.
  euclid_translate(self, position)
Convert to real screen coordinates.
  euclid_unscale(self, dist)
Scale a distance from a real screen distance.
  euclid_untranslate(self, position)
Convert from real screen coordinates.
  euclidean(self, drawCoords)
Set up the coordinate system.
  flip(self, key)
Switch images for the sprite (inherited from RotatedImage)
  forward(self, dist)
Move the turtle forward a distance
  get_deg(self)
return current turtle direction. (inherited from Turtle)
  get_position(self)
return a copy of the sprite's position (inherited from Drawable)
  get_rotation(self)
return angle of rotation (inherited from RotatedImage)
  get_size(self)
return size of sprite's rect. (inherited from Drawable)
  groups(self)
groups() -> list list used sprite containers (inherited from Sprite)
  grow(self, dx, dy)
Resize the window (larger) (inherited from Turtle)
  hide(self)
Set the penguin icon invisible (inherited from Turtle)
  home(self)
Move back to the home position (inherited from Turtle)
  kill(self)
kill() end life of sprite, remove from all groups (inherited from Sprite)
  left(self, d)
Turn left (counter-clockwise) a number of degrees (inherited from Turtle)
  line(self, p1, p2)
Draw a line which includes these 2 points.
  line_point_slope(self, p, m)
Draw a line through a point with a slope.
  lineSegment(self, p1, p2)
Draw a line segment between 2 points.
  lineTo(self, position)
Move turtle to position, drawing a line
  move(self)
set position to next position on path (inherited from RotatedImage)
  moveTo(self, position)
Move turtle to position, without drawing a line
  nudge(self, dx, dy)
Move sprite. (inherited from Drawable)
  nudge_color(self, red, blue, green)
Change the pen color by given amounts. (inherited from Turtle)
  onscreen(self, slack, **kw)
return True if image is on the screen or layer. (inherited from Drawable)
  pause(self)
stop moving along Path (inherited from Drawable)
  penDown(self)
Put pen down, ready to draw (inherited from Turtle)
  penUp(self)
Pull pen up. (inherited from Turtle)
  rectangle(self, side_length, side_width, clockwise, width, color, bgColor)
Quick drawing routine for rectangles.
  refresh(self)
Update the display. (inherited from Turtle)
  remove(self, group)
remove(group) remove a sprite from container (inherited from Sprite)
  remove_internal(self, group)
(inherited from Sprite)
  removeImage(self, key)
remove image by name (inherited from MultiImage)
  reset(self)
Clear the screen to BLACK, and return Penguin to home
  right(self, d)
Turn right (clockwise) a number of degrees (inherited from Turtle)
  rollback(self)
Throw out drawing layer. (inherited from Turtle)
  rollback_fill(self)
Throw out list of saved points (inherited from Turtle)
  rotate(self, rad)
rotate to the left by radians (inherited from RotatedImage)
  rotate_left(self)
set rotation rate to +2 (inherited from RotatedImage)
  rotate_right(self)
set rotation rate to -2 (inherited from RotatedImage)
  rotate_stop(self)
set rotation rate to 0 (inherited from RotatedImage)
  rotate_towards(self, point)
turn as quickly as possible towards a point (inherited from RotatedImage)
  runPath(self, frames)
call move() continuously (inherited from Drawable)
  save(self, filename)
Save background (the picture) as filename (inherited from Turtle)
  set_background(self, color)
Set the background color (inherited from Turtle)
  set_closest(self)
flip to the image for the current direction (inherited from RotatedImage)
  set_color(self, color, r, g, b)
Set the color for drawing. (inherited from Turtle)
  set_crect(self, crect)
set the collision pygame.Rectused for collision checking. (inherited from Drawable)
  set_fontSize(self, fontSize)
Set default font size for write and where (inherited from Turtle)
  set_home(self, pos)
Set the Penguin's home position (inherited from Turtle)
  set_image(self, key)
Change which image is being shown. (inherited from RotatedImage)
  set_path(self, path)
set which path to follow (inherited from Drawable)
  set_position(self, location, *args)
Move sprite to location. (inherited from Drawable)
  set_positionRandom(self, slack)
Move sprite to a random location on screen (inherited from Drawable)
  set_rotation(self, direction)
set angle of rotation (inherited from RotatedImage)
  set_rotationRate(self, rate)
set rate of rotation in radians / second (inherited from RotatedImage)
  set_size(self, size)
Set size of sprite's rect. (inherited from Drawable)
  set_visible(self, vis)
Set the penguin icon visible (inherited from Turtle)
  set_width(self, width)
Set line width for drawing. (inherited from Turtle)
  show(self)
Set the penguin icon visible (inherited from Turtle)
  shrink(self, dx, dy)
Resize the window (smaller) (inherited from Turtle)
  solid(self, other, move_both)
move sprite so that it does not overlap with other sprite (inherited from Drawable)
  square(self, side_length, clockwise, width, color, bgColor)
Quick drawing square.
  turnTo(self, deg)
Set turtle's direction to deg (degrees). (inherited from Turtle)
  uclear(self, surface)
clear sprite and update display (inherited from Drawable)
  udraw(self, surface)
Draw image and update display. (inherited from Drawable)
  unpause(self)
start moving along Path (inherited from Drawable)
  update(self, dirty)
Update the display (inherited from Turtle)
  wait(self)
Read pygame events until mouse click or any key press. (inherited from Turtle)
  where(self)
Briefly show the current position of the turtle.
  write(self, text, fontSize, color, bgColor)
Draw text from current position, and at current angle. (inherited from Turtle)

Method Details

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

cCircle(self, radius, color=None, width=None)

Quick drawing circle, centered on current position.

Does not move the turtle (ie, the turtle will be returned to its present location before returning)

"Quick drawing" means that this function draws the circle by calling pygame.draw.circle and not by simulating the drawing of a circle with a number of line segments and turns, which would be much slower.
Parameters:
radius - Radius of circle to draw. The center will be the current location.
color - Color to use for drawing circle, or the string 'random' to choose a random color. Does not affect the turtle's pen color (ie, the pen color will be restored before returning)
width - Thickness of line to use when drawing, or Zero (0) to fill with color.
Overrides:
pygsear.Drawable.Turtle.cCircle (inherited documentation)

circle(self, radius, clockwise=1, color=None, width=None)

Quick drawing circle. Starting from current position and rotation.

"Quick drawing" means that this function draws the circle by calling pygame.draw.circle and not by simulating the drawing of a circle with a number of line segments and turns, which would be much slower.
Parameters:
radius - Radius of circle to draw. The center will be 90 degrees from the current direction.
clockwise - Draw the circle turning clockwise from the current position, or if False, turn counter-clockwise.
color - Color to use for drawing circle, or the string 'random' to choose a random color. Does not affect the turtle's pen color (ie, the pen color will be restored before returning)
width - Thickness of line to use when drawing, or Zero (0) to fill with color.
Overrides:
pygsear.Drawable.Turtle.circle (inherited documentation)

cRectangle(self, side_length=20, side_width=10, width=None, color=None, bgColor=(0, 51, 0))

Quick drawing routine for rectangles.

Rectangle is centered on current position.
Parameters:
side_length - length of 1st and 3rd sides drawn
side_width - length of 2nd and last sides drawn
width - thickness of outline of rectangle width 0 means rectangle should be filled with color
color - RGB tuple, color of rectangle
bgColor - background color. Note that rectangle is not constrained to align horizontally or verically.
Overrides:
pygsear.Drawable.Turtle.cRectangle (inherited documentation)

cSquare(self, side_length=2, width=None, color=None, bgColor=(0, 51, 0))

Quick drawing routine for squares.

Square is centered on current position.
Parameters:
side_length - length of all sides drawn
width - thickness of outline of square width 0 means square should be filled with color
color - RGB tuple, color of square
bgColor - background color. Note that square is not constrained to align horizontally or verically.
Overrides:
pygsear.Drawable.Turtle.cSquare (inherited documentation)

drawEuclidCoords(self)

Draw the cartesian (x, y) coordinate system.

euclid_scale(self, dist)

Scale a distance to a real screen distance.

euclid_translate(self, position)

Convert to real screen coordinates.

euclid_unscale(self, dist)

Scale a distance from a real screen distance.

euclid_untranslate(self, position)

Convert from real screen coordinates.

euclidean(self, drawCoords=1)

Set up the coordinate system.

forward(self, dist)

Move the turtle forward a distance
Parameters:
dist - Number of pixels to move.
Overrides:
pygsear.Drawable.Turtle.forward (inherited documentation)

line(self, p1, p2)

Draw a line which includes these 2 points.

Unlike Turtle.line this will draw as much of the line as will fit on the screen, not just a line segment connecting the two points.

This function ignores the state of the pen.
Parameters:
p1 - One point on the line.
p2 - Second point on the line.

line_point_slope(self, p, m)

Draw a line through a point with a slope.

This function ignores the state of the pen.
Parameters:
p - One point on the line.
m - Slope of the line.

lineSegment(self, p1, p2)

Draw a line segment between 2 points.

This function ignores the state of the pen.
Parameters:
p1 - One endpoint of line segment.
p2 - Second endpoint of line segment.

lineTo(self, position)

Move turtle to position, drawing a line

Note that this ignores the state of the pen (up or down) and always draws a line in the current pen color.
Parameters:
position - Point (x, y) to draw the line to.
Overrides:
pygsear.Drawable.Turtle.lineTo (inherited documentation)

moveTo(self, position)

Move turtle to position, without drawing a line
Parameters:
position - Point (x, y) to move to
Overrides:
pygsear.Drawable.Turtle.moveTo (inherited documentation)

rectangle(self, side_length=20, side_width=10, clockwise=1, width=None, color=None, bgColor=(0, 51, 0))

Quick drawing routine for rectangles.
Parameters:
side_length - length of 1st and 3rd sides drawn
side_width - length of 2nd and last sides drawn
clockwise - all turns will be 90 degrees right clockwise 0 means all turns will be 90 degrees left
width - thickness of outline of rectangle width 0 means rectangle should be filled with color
color - RGB tuple, color of rectangle
bgColor - background color. Note that rectangle is not constrained to align horizontally or verically.
Overrides:
pygsear.Drawable.Turtle.rectangle (inherited documentation)

reset(self)

Clear the screen to BLACK, and return Penguin to home

also reset pen color to WHITE, and turn back to 90 deg (standing straight up)
Overrides:
pygsear.Drawable.Turtle.reset (inherited documentation)

square(self, side_length=20, clockwise=1, width=None, color=None, bgColor=(0, 51, 0))

Quick drawing square.
Parameters:
side_length - length of all sides drawn
clockwise - all turns will be 90 degrees right clockwise 0 means all turns will be 90 degrees left
width - thickness of outline of square width 0 means square should be filled with color
color - RGB tuple, color of square
bgColor - background color. Note that square is not constrained to align horizontally or verically.
Overrides:
pygsear.Drawable.Turtle.square (inherited documentation)

where(self)

Briefly show the current position of the turtle.
Overrides:
pygsear.Drawable.Turtle.where (inherited documentation)

Generated by Epydoc 1.1 on Sun Nov 30 19:33:11 2003 http://epydoc.sf.net