pymusicxml.score_components.PartGroup
- class pymusicxml.score_components.PartGroup(parts: Optional[Sequence[Part]] = None, has_bracket: bool = True, has_group_bar_line: bool = True)[source]
Bases:
MusicXMLComponent
,MusicXMLContainer
Represents a part group (a group of related parts, possible connected by a bracket)
- Parameters:
parts – list of parts contained in this group
has_bracket – whether or not to place a bracket around the group in the score
has_group_bar_line – whether or not to have bar lines cut through the entire group
Methods
render
()Renders this component to a tuple of ElementTree.Element.
Renders the "part-group" tag and containing "score-part" tags for the top of the MusicXML score.
Wraps this component in a
Score
so that it can be exported and viewedInherited Methods
append
(value)S.append(value) -- append value to the end of the sequence
clear
()count
(value)export_to_file
(file_path[, pretty_print])Exports this musical object (wrapped as a score) to the given file path.
extend
(values)S.extend(iterable) -- extend sequence by appending elements from the iterable
index
(value, [start, [stop]])Raises ValueError if the value is not present.
insert
(i, o)Insert the given object before the given index.
pop
([index])Raise IndexError if list is empty or index is out of range.
remove
(value)S.remove(value) -- remove first occurrence of value.
reverse
()S.reverse() -- reverse IN PLACE
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.
Attributes
List of parts in this group.
- render() Sequence[Element] [source]
Renders this component to a tuple of ElementTree.Element. (The reason for making it a tuple is that musical objects like chords are represented by several notes side by side, with all but the first containing a </chord> tag.)
- render_part_list_entry() Sequence[Element] [source]
Renders the “part-group” tag and containing “score-part” tags for the top of the MusicXML score.
- wrap_as_score() Score [source]
Wraps this component in a
Score
so that it can be exported and viewed
- append(value)
S.append(value) – append value to the end of the sequence
- clear() None -- remove all items from S
- count(value) integer -- return number of occurrences of value
- 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
- extend(values)
S.extend(iterable) – extend sequence by appending elements from the iterable
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- insert(i, o) None
Insert the given object before the given index.
- Parameters:
i – Index at which to insert
o – Object to insert
- pop([index]) item -- remove and return item at index (default last).
Raise IndexError if list is empty or index is out of range.
- remove(value)
S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
- reverse()
S.reverse() – reverse IN PLACE
- 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.