tweak

topleveltools.tweak(argument)

Makes LilyPond tweak manager.

Tweaks markup:

>>> staff = Staff("c'4 d' e' f'")
>>> markup = Markup('Allegro assai', direction=Up)
>>> tweak(markup).color = 'red'
>>> attach(markup, staff[0])
>>> show(staff) 

Survives copy:

>>> import copy
>>> staff = Staff("c'4 d' e' f'")
>>> markup_1 = Markup('Allegro assai', direction=Up)
>>> tweak(markup_1).color = 'red'
>>> markup_2 = copy.copy(markup_1)
>>> attach(markup_2, staff[0])
>>> show(staff) 

Survives dot-chaining:

>>> staff = Staff("c'4 d' e' f'")
>>> markup = Markup('Allegro assai', direction=Up)
>>> tweak(markup).color = 'red'
>>> markup = markup.italic()
>>> attach(markup, staff[0])
>>> show(staff) 

Works for opposite-directed coincident markup:

>>> staff = Staff("c'4 d' e' f'")
>>> markup_1 = Markup('Allegro assai ...', direction=Up)
>>> tweak(markup_1).color = 'red'
>>> attach(markup_1, staff[0])
>>> markup_2 = Markup('... ma non troppo', direction=Down)
>>> tweak(markup_2).color = 'blue'
>>> tweak(markup_2).staff_padding = 4
>>> attach(markup_2, staff[0])
>>> show(staff) 

Ignored for same-directed coincident markup:

>>> staff = Staff("c'4 d' e' f'")
>>> markup_1 = Markup('Allegro assai ...', direction=Up)
>>> tweak(markup_1).color = 'red'
>>> attach(markup_1, staff[0])
>>> markup_2 = Markup('... ma non troppo', direction=Up)
>>> tweak(markup_2).color = 'blue'
>>> tweak(markup_2).staff_padding = 4
>>> attach(markup_2, staff[0])
>>> show(staff) 

Todo

Remove courtesy autocolumn in favor of explicit tweaks?

Returns LilyPond tweak manager:

>>> tweak(markup_1)
LilyPondTweakManager(('color', 'red'))