pymusicxml.music_xml_objects.TextAnnotation¶
-
class
pymusicxml.music_xml_objects.
TextAnnotation
(text: str, placement: str = 'above', font_size: float = None, italic: bool = False, bold: bool = False, voice: int = 1, staff: int = None, dashed_line: int = None, **kwargs)[source]¶ Bases:
pymusicxml.music_xml_objects.Direction
Class representing text that is attached to the staff
- Parameters
text – the text of the annotation
placement – where to place the text in relation to the staff (“above” or “below”)
font_size – the font size of the text
italic – whether or not the text is italicized
voice – Which voice to attach to
staff – Which staff to attach to if the part has multiple staves
dashed_line – if this text starts a dashed line (e.g. accel——–) pass an id number to associate with that line to this argument. The line can then be ended with an
EndDashedLine
kwargs – any extra properties of the musicXML “words” tag aside from font-size and italics can be passed to kwargs
Methods
render
()Renders this component to a tuple of ElementTree.Element.
Inherited Methods
export_to_file
(file_path[, pretty_print])Exports this musical object (wrapped as a score) to the given file path.
to_xml
([pretty_print])Renders this component to MusicXML, adding a version tag, but not wrapping it up as a full score.
view_in_software
(command)Uses the given terminal command to create a score out of this musical object, and open it in music notation software.
Wraps this component in a
Score
so that it can be exported and viewed-
export_to_file
(file_path: str, pretty_print: bool = True) → None¶ Exports this musical object (wrapped as a score) to the given file path.
- Parameters
file_path – The path of the file we want to write to.
pretty_print – If True, breaks the MusicXML onto multiple lines, with indentation
-
to_xml
(pretty_print: bool = False) → str¶ Renders this component to MusicXML, adding a version tag, but not wrapping it up as a full score.
- Parameters
pretty_print – If True, breaks the MusicXML onto multiple lines, with indentation
-
view_in_software
(command: str) → None¶ Uses the given terminal command to create a score out of this musical object, and open it in music notation software.
- Parameters
command – The terminal command corresponding to the software with which we want to open the score.
-
wrap_as_score
() → pymusicxml.music_xml_objects.Score¶ Wraps this component in a
Score
so that it can be exported and viewed