Arrow

class indicatortools.Arrow(arrow_width=0.25, dash_fraction=1, dash_period=None, left_broken_padding=None, left_broken_text=False, left_hspace=0.25, left_padding=None, left_stencil_align_direction_y=Center, right_arrow=True, right_broken_arrow=None, right_broken_padding=0, right_padding=1.5, right_stencil_align_direction_y=Center, style=None)

An arrow.

Example 1. String contact position spanner:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow()
>>> print(format(arrow))
indicatortools.Arrow(
    arrow_width=0.25,
    dash_fraction=1,
    left_broken_text=False,
    left_hspace=0.25,
    left_stencil_align_direction_y=Center,
    right_arrow=True,
    right_broken_padding=0,
    right_padding=1.5,
    right_stencil_align_direction_y=Center,
    )
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Arrow is a preconfigured line segment.

Arrow formats as a text spanner.

Follow the piecewise definition protocol shown here.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_indicatortools { graph [label=indicatortools]; "abjad.tools.indicatortools.Arrow.Arrow" [color=black, fontcolor=white, group=2, label=<<B>Arrow</B>>, shape=box, style="filled, rounded"]; "abjad.tools.indicatortools.LineSegment.LineSegment" [color=3, group=2, label=LineSegment, shape=box]; "abjad.tools.indicatortools.LineSegment.LineSegment" -> "abjad.tools.indicatortools.Arrow.Arrow"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.indicatortools.LineSegment.LineSegment"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Attribute summary

arrow_width Gets arrow width of arrow.
dash_fraction Gets dash fraction of arrow.
dash_period Gets dash period of arrow.
default_scope Gets default scope of arrow.
left_broken_padding Gets left broken padding of line segment.
left_broken_text Gets left broken text of arrow.
left_hspace Gets left hspace of line segment.
left_padding Gets left padding of line segment.
left_stencil_align_direction_y Gets left stencil align direction Y of line segment.
right_arrow Is true when right end of line segment carries an arrow.
right_broken_arrow Is true when arrow should appear immediately before line break.
right_broken_padding Gets right broken padding of line segment.
right_padding Gets right padding of line segment.
right_stencil_align_direction_y Gets right stencil align direction Y of line segment.
style Gets style of arrow.
__copy__(\*args) Copies Abjad value object.
__eq__(expr) Is true when all initialization values of Abjad value object equal the initialization values of expr.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad value object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

Arrow.arrow_width

Gets arrow width of arrow.

Example 1. Arrow width equals 0.25:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(arrow_width=0.25)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in thin arrow head.

This is default behavior.

Example 2. Arrow width equals 0.5:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(arrow_width=0.5)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in wide arrow head.

Example 3. Arrow width equals 1:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(arrow_width=1)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in very wide arrow head.

Defaults to 0.25.

Returns integer or float.

Arrow.dash_fraction

Gets dash fraction of arrow.

Example 1. Dash fraction equals 100% of dash period:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(dash_fraction=1)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

This is default behavior.

Example 2. Dash fraction equals 50% of dash period:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(dash_fraction=0.5)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Example 3. Dash fraction equals 10% of dash period:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(dash_fraction=0.1)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Defaults to 1.

Returns integer or float.

Arrow.dash_period

Gets dash period of arrow.

Example 1. Dash period equals none:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(
...     dash_period=None,
...     )
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in a solid line.

This is default behavior.

Example 2. Dash period equals 1 (with dash fraction equal to 25%):

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(
...     dash_fraction=0.25,
...     dash_period=1,
...     )
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in fine dashes.

Example 3. Dash period equals 4 (with dash fraction equal to 25%):

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(
...     dash_fraction=0.25,
...     dash_period=4,
...     )
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in coarse dashes.

Defaults to none.

Returns integer or float.

Arrow.default_scope

Gets default scope of arrow.

>>> arrow = indicatortools.Arrow()
>>> arrow.default_scope is None
True

Returns none.

(LineSegment).left_broken_padding

Gets left broken padding of line segment.

Returns float or none.

Arrow.left_broken_text

Gets left broken text of arrow.

Example 1. Left broken text set to false:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow()
>>> print(format(arrow))
indicatortools.Arrow(
    arrow_width=0.25,
    dash_fraction=1,
    left_broken_text=False,
    left_hspace=0.25,
    left_stencil_align_direction_y=Center,
    right_arrow=True,
    right_broken_padding=0,
    right_padding=1.5,
    right_stencil_align_direction_y=Center,
    )
>>> attach(start_markup, staff[2], is_annotation=True)
>>> attach(stop_markup, staff[6], is_annotation=True)
>>> attach(arrow, staff[2])
>>> attach(spannertools.TextSpanner(), staff[2:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in no text immediately after line break. (This is default behavior.)

Example 2. Left broken text set explicitly:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> left_broken_markup = Markup('(pont./ord.)').upright()
>>> arrow = indicatortools.Arrow(
...     left_broken_text=left_broken_markup,
... )
>>> print(format(arrow))
indicatortools.Arrow(
    arrow_width=0.25,
    dash_fraction=1,
    left_broken_text=markuptools.Markup(
        contents=(
            markuptools.MarkupCommand(
                'upright',
                '(pont./ord.)'
                ),
            ),
        ),
    left_hspace=0.25,
    left_stencil_align_direction_y=Center,
    right_arrow=True,
    right_broken_padding=0,
    right_padding=1.5,
    right_stencil_align_direction_y=Center,
    )
>>> attach(start_markup, staff[2], is_annotation=True)
>>> attach(stop_markup, staff[6], is_annotation=True)
>>> attach(arrow, staff[2])
>>> attach(spannertools.TextSpanner(), staff[2:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Set to markup, boolean or none.

(LineSegment).left_hspace

Gets left hspace of line segment.

Returns float or none.

(LineSegment).left_padding

Gets left padding of line segment.

Returns float or none.

(LineSegment).left_stencil_align_direction_y

Gets left stencil align direction Y of line segment.

Returns float or none.

(LineSegment).right_arrow

Is true when right end of line segment carries an arrow. Otherwise false.

Returns true, false or none.

Arrow.right_broken_arrow

Is true when arrow should appear immediately before line break. Otherwise false.

Example 1. Right broken arrow set to none:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow()
>>> print(format(arrow))
indicatortools.Arrow(
    arrow_width=0.25,
    dash_fraction=1,
    left_broken_text=False,
    left_hspace=0.25,
    left_stencil_align_direction_y=Center,
    right_arrow=True,
    right_broken_padding=0,
    right_padding=1.5,
    right_stencil_align_direction_y=Center,
    )
>>> attach(start_markup, staff[2], is_annotation=True)
>>> attach(stop_markup, staff[6], is_annotation=True)
>>> attach(arrow, staff[2])
>>> attach(spannertools.TextSpanner(), staff[2:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Results in arrow immediately before line break. (This is default behavior.)

Example 2. Right broken arrow set to false:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(
...     right_broken_arrow=False,
... )
>>> print(format(arrow))
indicatortools.Arrow(
    arrow_width=0.25,
    dash_fraction=1,
    left_broken_text=False,
    left_hspace=0.25,
    left_stencil_align_direction_y=Center,
    right_arrow=True,
    right_broken_arrow=False,
    right_broken_padding=0,
    right_padding=1.5,
    right_stencil_align_direction_y=Center,
    )
>>> attach(start_markup, staff[2], is_annotation=True)
>>> attach(stop_markup, staff[6], is_annotation=True)
>>> attach(arrow, staff[2])
>>> attach(spannertools.TextSpanner(), staff[2:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Set to true, false or none.

(LineSegment).right_broken_padding

Gets right broken padding of line segment.

Returns float or none.

(LineSegment).right_padding

Gets right padding of line segment.

Returns float or none.

(LineSegment).right_stencil_align_direction_y

Gets right stencil align direction Y of line segment.

Returns float or none.

Arrow.style

Gets style of arrow.

Example 1. Style equals none:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(style=None)
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

LilyPond defaults to solid line.

This is default behavior.

Example 2. Style equals zig-zag:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(style='zigzag')
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Example 3. Style equals trill:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(style='trill')
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Example 4. Style equals dotted line:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> start_markup = Markup('pont.').upright()
>>> stop_markup = Markup('ord.').upright()
>>> arrow = indicatortools.Arrow(style='dotted-line')
>>> attach(start_markup, staff[0], is_annotation=True)
>>> attach(stop_markup, staff[-1], is_annotation=True)
>>> attach(arrow, staff[0])
>>> attach(spannertools.TextSpanner(), staff[:])
>>> override(staff).text_script.staff_padding = 1.25
>>> override(staff).text_spanner.staff_padding = 2
>>> show(staff) 

Defaults to none.

Returns string or none.

Special methods

(AbjadValueObject).__copy__(*args)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(expr)

Is true when all initialization values of Abjad value object equal the initialization values of expr.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(AbjadObject).__ne__(expr)

Is true when Abjad object does not equal expr. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.