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

Class Path

Known Subclasses:
BrownianPath, ListPath, Offset_path, PathNG, RandomOnscreen, StationaryPath, SuperPath, TurtlePath, VelocityPath

A set of points.
Method Summary
  __init__(self, position, duration)
Initialize the Path
  __iter__(self)
  get_direction(self)
Return the direction from the previous location to the current location.
  get_position(self)
Return position along Path
  get_x(self)
return x component of position
  get_y(self)
return y component of position
  next(self)
return position
  onscreen(self, slack)
true if path position is on main window
  pause(self)
stop moving along path
  reset(self)
put path back to original state
  set_endTime(self, duration)
Path will raise StopIteration after self.duration seconds
  set_position(self, position)
Set position and update positionOld
  unpause(self)
resume moving along path

Method Details

__init__(self, position=(0, 0), duration=None)
(Constructor)

Initialize the Path
Parameters:
position - initial coordinates
duration - Seconds until Path should raise StopIteration

get_direction(self)

Return the direction from the previous location to the current location.

get_position(self)

Return position along Path

get_x(self)

return x component of position

get_y(self)

return y component of position

next(self)

return position
Raises:
StopIteration - If duration has expired, or if position has been set to (None, None)

onscreen(self, slack=0)

true if path position is on main window

Drawable objects should be using the pygsear.Drawable.onscreen instead.
Parameters:
slack - position can be this far off window and still return True.

pause(self)

stop moving along path

reset(self)

put path back to original state

set_endTime(self, duration=None)

Path will raise StopIteration after self.duration seconds
Parameters:
duration - Seconds until Path should raise StopIteration. If duration is not specified (or is None) uses self.duration so that set_endTime() can be used to reset the Path duration counter.

set_position(self, position)

Set position and update positionOld

For many paths, this position will be overridden by the next call to next() and so it will never be seen.

Also, many Drawable objects maintain their own position and so a call to that object's set_position may be more appropriate.

unpause(self)

resume moving along path

Generated by Epydoc 2.0 on Sat Dec 9 14:11:20 2006 http://epydoc.sf.net