KeySignature

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.indicators" { graph [label="abjad.indicators"]; node [color=1]; "abjad.indicators.KeySignature.KeySignature" [URL="../api/abjad/indicators/KeySignature.html#abjad.indicators.KeySignature.KeySignature", color=black, fontcolor=white, label="Key\nSignature", target=_top]; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/indicators/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/indicators/../system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.indicators.KeySignature.KeySignature"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.indicators.KeySignature.KeySignature(tonic='c', mode='major', *, tweaks=None)

Key signature.

>>> staff = abjad.Staff("e'8 fs'8 gs'8 a'8")
>>> key_signature = abjad.KeySignature('e', 'major')
>>> abjad.attach(key_signature, staff[0])
>>> abjad.show(staff) 
>>> staff = abjad.Staff("e'8 fs'8 g'8 a'8")
>>> key_signature = abjad.KeySignature('e', 'minor')
>>> abjad.attach(key_signature, staff[0])
>>> abjad.show(staff) 

Attributes Summary

__str__ Gets string representation of key signature.
context Gets (historically conventional) context.
mode Gets mode of key signature.
name Gets name of key signature.
parameter Is true.
redraw Is true.
tonic Gets tonic of key signature.
tweaks Gets tweaks.

Special methods

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

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

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).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of key signature.

E major:

>>> str(abjad.KeySignature('e', 'major'))
'e-major'

e minor:

>>> str(abjad.KeySignature('e', 'minor'))
'e-minor'
Return type:str

Read-only properties

context

Gets (historically conventional) context.

E major:

>>> key_signature = abjad.KeySignature('e', 'major')
>>> key_signature.context
'Staff'

e minor:

>>> key_signature = abjad.KeySignature('e', 'minor')
>>> key_signature.context
'Staff'

Override with abjad.attach(..., context='...').

Return type:str
mode

Gets mode of key signature.

E major:

>>> key_signature = abjad.KeySignature('e', 'major')
>>> key_signature.mode
Mode('major')

e minor:

>>> key_signature = abjad.KeySignature('e', 'minor')
>>> key_signature.mode
Mode('minor')

Returns mode.

name

Gets name of key signature.

E major:

>>> key_signature = abjad.KeySignature('e', 'major')
>>> key_signature.name
'E major'

e minor:

>>> key_signature = abjad.KeySignature('e', 'minor')
>>> key_signature.name
'e minor'
Return type:str
parameter

Is true.

>>> abjad.KeySignature('e', 'major').parameter
True

Class constant.

Return type:bool
redraw

Is true.

>>> abjad.KeySignature('e', 'major').redraw
True

Class constant.

Return type:bool
tonic

Gets tonic of key signature.

E major:

>>> key_signature = abjad.KeySignature('e', 'major')
>>> key_signature.tonic
NamedPitchClass('e')

e minor:

>>> key_signature = abjad.KeySignature('e', 'minor')
>>> key_signature.tonic
NamedPitchClass('e')
Return type:NamedPitchClass
tweaks

Gets tweaks.

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> key = abjad.KeySignature('e', 'minor')
>>> abjad.tweak(key).color = 'blue'
>>> abjad.attach(key, staff[0])
>>> abjad.show(staff) 
>>> staff = abjad.Staff("c'4 d' e' f'")
>>> key = abjad.KeySignature('e', 'minor', tweaks=[('color', 'blue')])
>>> abjad.attach(key, staff[0])
>>> abjad.show(staff) 
Return type:Optional[LilyPondTweakManager]