brown.core.spanner

classes

A Mixin class for GraphicObjects with starting and ending anchors.

If the spanner (main GraphicObject) is in a Flowable, the endpoint must be in the same one. Likewise, if the spanner is not in one, the endpoint must not be in one either.

This mixin only provides a common interface for ending anchors. The starting position of this spanner should be the main object's GraphicObject.pos, and the starting anchored should be the its GraphicObject.parent. It is up to the implementing class to decide how to use this information.

For an example implementation, see Slur.

__init__ (end_pos, end_parent=None) permalink view source

arguments:

end_pos (Point or init tuple): The position of the endpoint

end_parent (GraphicObject or None): The parent of the endpoint. end_pos will be relative to this object. If None, this defaults to the spanner.

warning:

If the spanner is in a Flowable, end_parent must be in the same one. Likewise, if the spanner is not in a Flowable, this must not be either.

properties

end_x: Unit The x position of the endpoint permalink view source

end_y: Unit The y position of the endpoint permalink view source

end_pos: Point The position of the endpoint permalink view source

end_parent: GraphicObject The parent of the endpoint. permalink view source

self.end_pos is measured relative to this. To make self.end_pos relative to self.pos, simply set this to self.

spanner_x_length: Unit The x-axis length of the spanner. permalink view source

Implementing subclasses will often want to override GraphicObject.length to return this.

read-only.

spanner_length: Unit The 2d length of the spanner. permalink view source

Note: This takes into account both the x and y axis. For only the horizontal length, use spanner_x_length.

read-only.