Home | Trees | Index | Help |
---|
Package pygsear :: Module Drawable :: Class Turtle |
|
object
--+ |Sprite
--+ |Drawable
--+ |MultiImage
--+ |RotatedImage
--+ | Turtle
EuclidTurtle
Method Summary | |
---|---|
__init__(self,
w,
position,
deg,
color,
filename,
colorkey,
convert)
| |
Move the turtle backward distance. | |
Start a new layer for drawing. | |
Start saving points for filling a polygon later | |
Flash the turtle on and off. | |
Quick drawing circle, centered on current position. | |
Quick drawing circle. | |
erase sprite image to background, returning affected rect | |
Clear the screen to background color. | |
Copy drawing layer to base window. | |
Fill the polygon of saved points | |
Quick drawing routine for rectangles. | |
Quick drawing routine for squares. | |
draw image, returning affected rect | |
Move the turtle forward a distance | |
return current turtle direction. | |
Resize the window (larger) | |
Set the penguin icon invisible | |
Move back to the home position | |
Turn left (counter-clockwise) a number of degrees | |
Draw a line segment between 2 points. | |
Move turtle to position, drawing a line | |
Move turtle to position, without drawing a line | |
Change the pen color by given amounts. | |
Put pen down, ready to draw | |
Pull pen up. | |
Quick drawing routine for rectangles. | |
Update the display. | |
Clear the screen to LBLUE, and return Penguin to home | |
Turn right (clockwise) a number of degrees | |
Throw out drawing layer. | |
Throw out list of saved points | |
Save background (the picture) as filename | |
Set the background color | |
Set the color for drawing. | |
Set default font size for write and where | |
Set the Penguin's home position | |
Set the penguin icon visible | |
Set line width for drawing. | |
Set the penguin icon visible | |
Resize the window (smaller) | |
Quick drawing square. | |
Set turtle's direction to deg (degrees). | |
Update the display | |
Read pygame events until mouse click or any key press. | |
Briefly show the current position of the turtle. | |
Draw text from current position, and at current angle. | |
Inherited from RotatedImage | |
Switch images for the sprite | |
return angle of rotation | |
set position to next position on path | |
rotate to the left by radians | |
set rotation rate to +2 | |
set rotation rate to -2 | |
set rotation rate to 0 | |
turn as quickly as possible towards a point | |
flip to the image for the current direction | |
Change which image is being shown. | |
set angle of rotation | |
set rate of rotation in radians / second | |
Inherited from MultiImage | |
add image to list of available images | |
remove image by name | |
Change the size of sprite's image, and rect. | |
Inherited from Drawable | |
bool |
Performs a los (line of sight) check from the center of the source to the center of the target. |
Align the Drawable in its layer | |
bool
|
return True if this sprite and other sprite overlap. |
Drawable or False
|
return True if this sprite and any in list of others collide. |
List
|
return True if this sprite and any in list of others collide. |
return the direction from the sprite to a point | |
return the distance from the sprite to a point | |
return a copy of the sprite's position | |
return size of sprite's rect. | |
Move sprite. | |
return True if image is on the screen or layer. | |
stop moving along Path | |
call move() continuously | |
set the collision pygame.Rect used for collision
checking. | |
set which path to follow | |
Move sprite to location. | |
Move sprite to a random location on screen | |
Set size of sprite's rect. | |
move sprite so that it does not overlap with other sprite | |
clear sprite and update display | |
Draw image and update display. | |
start moving along Path | |
Inherited from Sprite | |
| |
add(group or list of of groups, ...) add a sprite to container | |
| |
alive() -> bool check to see if the sprite is in any groups | |
groups() -> list of groups list used sprite containers | |
kill() remove this sprite from all groups | |
remove(group or list of groups, ...) remove a sprite from container | |
| |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
Inherited from type | |
T.__new__(S, ...) -> a new object with type S, a subtype of T |
Class Variable Summary | |
---|---|
tuple |
BGCOLOR = (0, 0, 0)
|
tuple |
COLOR = (255, 255, 255)
|
Inherited from MultiImage | |
NoneType |
filenames = None |
Method Details |
---|
backward(self, dist)Move the turtle backward distance. eqivalent to forward(-dist)
|
begin(self, interactive=1)Start a new layer for drawing. Use commit() to copy layer to the base window, or use rollback() to throw away the layer and return to drawing directly to the base window. |
begin_fill(self)Start saving points for filling a polygon later Each move pushes the current point in to a list. Use commit_fill() to fill inside of the points use rollback_fill() to throw away the list without filling. |
blink(self, times=1, delay=350)Flash the turtle on and off.
|
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 callingpygame.draw.circle and not by simulating the
drawing of a circle with a number of line segments and turns, which
would be much slower.
|
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 callingpygame.draw.circle and not by simulating the
drawing of a circle with a number of line segments and turns, which
would be much slower.
|
clear(self, surface=None)erase sprite image to background, returning affected rect
|
clearScreen(self)Clear the screen to background color. Does not move the Penguin. I am considering a shorter name, perhaps cls |
commit(self)Copy drawing layer to base window. |
commit_fill(self, color=None)Fill the polygon of saved points Start saving points for fill with begin_fill() Fill is done with pygame.draw.polygon, so if the line of points crosses itself, the fill will turn inside out. |
cRectangle(self, side_length=20, side_width=10, width=None, color=None, bgColor=(0, 51, 0, 0))Quick drawing routine for rectangles. Rectangle is centered on current position.
|
cSquare(self, side_length=20, width=None, color=None, bgColor=(0, 51, 0, 0))Quick drawing routine for squares. Square is centered on current position.
|
draw(self, surface=None)draw image, returning affected rect
|
forward(self, dist)Move the turtle forward a distance
|
get_deg(self)return current turtle direction. Zero (0) degrees is along the positive x-axis. |
grow(self, dx=50, dy=50)Resize the window (larger)
|
hide(self)Set the penguin icon invisible |
home(self)Move back to the home position |
left(self, d)Turn left (counter-clockwise) a number of degrees
|
line(self, p1, p2)Draw a line segment between 2 points. This function ignores the state of the pen. In other words, it will draw a line to the screen in the current color even if the turtle's pen is up.
|
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.
|
moveTo(self, position)Move turtle to position, without drawing a line
|
nudge_color(self, red=None, blue=None, green=None)Change the pen color by given amounts. Amounts can be either integer numbers (to be added to the RGB tuple components), or percentages (to increase or decrease that component by given percent) ie, if color is(100, 100, 100) before the call, a
call to nudge_color(red=50, blue=-10,
green="75%") will result in the color being set to
(150, 90, 75)
|
penDown(self)Put pen down, ready to draw |
penUp(self)Pull pen up. Most movement will not make a mark. Note that some functions (circle notably) do not pay any attention to the state of the pen. |
rectangle(self, side_length=20, side_width=10, clockwise=1, width=None, color=None, bgColor=(0, 51, 0, 0))Quick drawing routine for rectangles.
|
refresh(self)Update the display. This is useful when your system does not automatically refresh the screen after it gets covered up and then uncovered. |
reset(self)Clear the screen to LBLUE, and return Penguin to home also reset pen color to WHITE, and turn back to 90 deg (standing straight up) |
right(self, d)Turn right (clockwise) a number of degrees
|
rollback(self)Throw out drawing layer. |
rollback_fill(self)Throw out list of saved points |
save(self, filename)Save background (the picture) as filename
|
set_background(self, color=None)Set the background color Saves the current picture before changing the background color and restores the picture afterward. The picture may not be quite the same if parts of it were drawn using the old bg color. |
set_color(self, color=None, r=None, g=None, b=None)Set the color for drawing. The caller can choose one of a few ways to set the color:
|
set_fontSize(self, fontSize=40)Set default font size forwrite and where
|
set_home(self, pos=None)Set the Penguin's home position |
set_visible(self, vis=1)Set the penguin icon visible |
set_width(self, width)Set line width for drawing.
|
show(self)Set the penguin icon visible |
shrink(self, dx=50, dy=50)Resize the window (smaller)
|
square(self, side_length=20, clockwise=1, width=None, color=None, bgColor=(0, 51, 0, 0))Quick drawing square.
|
turnTo(self, deg)Set turtle's direction to deg (degrees).
|
update(self, dirty=None)Update the display
|
wait(self)Read pygame events until mouse click or any key press. |
where(self)Briefly show the current position of the turtle. |
write(self, text, fontSize=None, color=None, bgColor=(0, 51, 0, 0))Draw text from current position, and at current angle.
|
Class Variable Details |
---|
BGCOLOR
|
COLOR
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.0 on Sat Dec 9 14:11:19 2006 | http://epydoc.sf.net |