LabelExpression

class expressiontools.LabelExpression(callbacks=None)

Label expression.

Example 1. Makes expression to color leaves:

>>> expression = label()
>>> expression = expression.color_leaves()
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 2. Makes expression to color note note heads:

>>> expression = label()
>>> expression = expression.color_note_heads()
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 3. Makes expression to label logical ties with durations:

>>> expression = label()
>>> expression = expression.with_durations(preferred_denominator=8)
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 4. Makes expression to label logical ties with indices:

>>> expression = label()
>>> expression = expression.with_indices()
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 5. Makes expression to label leaves with indices:

>>> expression = label()
>>> expression = expression.with_indices(prototype=scoretools.Leaf)
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 6. Makes expression to label consecutive notes with named intervals:

>>> expression = label()
>>> expression = expression.with_intervals()
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 7. Makes expression to label logical ties with start offsets:

>>> expression = label()
>>> expression = expression.with_start_offsets()
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Example 8. Makes expression to label logical ties with pitch names:

>>> expression = label()
>>> expression = expression.with_pitches()
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression(staff)
>>> show(staff) 

Note

Add usage examples to this docstring. Do not add usage examples to property and method docstrings. Properties and methods will all be derived automatically from the LabeAgent class at some point in future.

Initializer returns expression.

Expression returns none.

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.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_expressiontools { graph [label=expressiontools]; "abjad.tools.expressiontools.Expression.Expression" [color=3, group=2, label=Expression, shape=box]; "abjad.tools.expressiontools.LabelExpression.LabelExpression" [color=black, fontcolor=white, group=2, label=<<B>LabelExpression</B>>, shape=box, style="filled, rounded"]; "abjad.tools.expressiontools.Expression.Expression" -> "abjad.tools.expressiontools.LabelExpression.LabelExpression"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.expressiontools.Expression.Expression"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

callbacks Gets callbacks.
color_container([color]) Make color-container callback.
color_leaves([color]) Makes color-leaves callback.
color_note_heads([color_map]) Makes color-note-heads callback.
remove_markup() Makes remove-markup callback.
vertical_moments([direction, prototype]) Makes vertical-moments callback.
with_durations([direction, ...]) Makes with-durations callback.
with_indices([direction, prototype]) Makes with-indices callback.
with_intervals([direction, prototype]) Makes with-intervals callback.
with_pitches([direction, prototype]) Makes with-pitches callback.
with_start_offsets([clock_time, direction, ...]) Makes with-start-offsets callback.
__call__([expr]) Calls label expression on expr.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

(Expression).callbacks

Gets callbacks.

Returns tuple or none.

Methods

LabelExpression.color_container(color='red')

Make color-container callback.

Returns callback.

LabelExpression.color_leaves(color='red')

Makes color-leaves callback.

Returns callback.

LabelExpression.color_note_heads(color_map=None)

Makes color-note-heads callback.

Returns callback.

LabelExpression.remove_markup()

Makes remove-markup callback.

Returns callback.

LabelExpression.vertical_moments(direction=Up, prototype=None)

Makes vertical-moments callback.

Returns callback.

LabelExpression.with_durations(direction=Up, preferred_denominator=None)

Makes with-durations callback.

Returns callback.

LabelExpression.with_indices(direction=Up, prototype=None)

Makes with-indices callback.

Returns callback.

LabelExpression.with_intervals(direction=Up, prototype=None)

Makes with-intervals callback.

Returns callback.

LabelExpression.with_pitches(direction=Up, prototype=None)

Makes with-pitches callback.

Returns callback.

LabelExpression.with_start_offsets(clock_time=False, direction=Up, font_size=None)

Makes with-start-offsets callback.

Returns callback.

Special methods

LabelExpression.__call__(expr=None)

Calls label expression on expr.

Makes label agent with expr as client.

Applies callbacks to label agent client.

Operates in place on label agent client.

Returns none.

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

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

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

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.