musicscore.layout
- class musicscore.layout.Margins(parent: PageLayout | SystemLayout, left: float | int = None, right: float | int = None, top: float | int = None, bottom: float | int = None)[source]
Bases:
object- property bottom
Set and get
XMLBottomMarginvalue of parent.
- property left: int | float
Set and get
XMLLeftMarginvalue of parent.
- property parent
- Returns:
parent layout object.
PageLayoutandSystemLayoutare implemented.
- property right: int | float
Set and get
XMLRightMarginvalue of parent.
- property top: int | float
Set and get
XMLTopMarginvalue of parent.
- class musicscore.layout.PageLayout(size: str = 'A4', orientation: str = 'portrait')[source]
Bases:
XMLWrapper,LayoutMixin- Parameters:
size –
PAGE_SIZESorientation – ‘portrait’, ‘landscape’
- XMLClass
alias of
XMLPageLayout
- to_string(*args, **kwargs) str
XMLWrappermethodCalls
to_stringmethod of self.xml_object- Returns:
musicxml snippet
- property orientation: str
Set and get orientation. Permitted values are [‘portrait’, ‘landscape’]. After setting value, if parent and size already exist, page’s height and width are set.
- Returns:
‘portrait’, ‘landscape’
- Return type:
str
- property parent
- Returns:
musicscore object which uses this layout object.
Todo
Print implementation: At this moment only
Scoreis implemented.
- property size: str
Set and get orientation. Permitted values are keys of obj:PAGE_SIZES. After setting value, if parent and orientation already exist, page’s height and width are set.
- Returns:
sizes in
PAGE_SIZES- Return type:
str
- property xml_object: XMLElement
XMLWrappermethodThis musicscore class has an equivalent
MusicXMLclass which can be reached via this property.If an attribute is not found directly in the main class, it wll be passed on to
__get_attribute__or__set__attribute__methods ofself.xml_object. It can also use the short cut attributes ofXMLElementto get or set the first child.- Returns:
wrapped MusicXML element of type
XMLClass
- class musicscore.layout.Scaling(millimeters: int | float = 7.2319, tenths: int | float = 40)[source]
Bases:
XMLWrapper- XMLClass
alias of
XMLScaling
- millimeters_to_tenths(x: int | float) int | float[source]
Converts millimeter value into tenths
- Parameters:
x – millimeters
- Returns:
calculated tenths
- to_string(*args, **kwargs) str
XMLWrappermethodCalls
to_stringmethod of self.xml_object- Returns:
musicxml snippet
- property millimeters: int | float
Set and get millimeters value of scaling object. After setting value, parent
Score’sPageLayoutis updated to reflect the changes.- Returns:
millimeters
- Return type:
Union[int, float]
- property score
Set and get parent
Score. After setting score, itsXMLScalingandXMLDefaultsare created if needed.- Returns:
parent score
- Return type:
- property tenths: int | float
Set and get tenths value of scaling object. After setting value, parent
Score’sPageLayoutis updated to reflect the changes.- Returns:
tenths
- Return type:
Union[int, float]
- property xml_object: XMLElement
XMLWrappermethodThis musicscore class has an equivalent
MusicXMLclass which can be reached via this property.If an attribute is not found directly in the main class, it wll be passed on to
__get_attribute__or__set__attribute__methods ofself.xml_object. It can also use the short cut attributes ofXMLElementto get or set the first child.- Returns:
wrapped MusicXML element of type
XMLClass
- class musicscore.layout.StaffLayout(staff_distance=80)[source]
Bases:
XMLWrapper,LayoutMixin- XMLClass
alias of
XMLStaffLayout
- to_string(*args, **kwargs) str
XMLWrappermethodCalls
to_stringmethod of self.xml_object- Returns:
musicxml snippet
- property parent
- Returns:
musicscore object which uses this layout object.
Todo
Print implementation: At this moment only
Scoreis implemented.
- property staff_distance: int | float | None
Set and get
value_ofXMLStaffDistance.- Returns:
self.xml_object.xml_staff_distance.value_- Return type:
int, float, None
- property xml_object: XMLElement
XMLWrappermethodThis musicscore class has an equivalent
MusicXMLclass which can be reached via this property.If an attribute is not found directly in the main class, it wll be passed on to
__get_attribute__or__set__attribute__methods ofself.xml_object. It can also use the short cut attributes ofXMLElementto get or set the first child.- Returns:
wrapped MusicXML element of type
XMLClass
- class musicscore.layout.SystemLayout(system_distance: int | float = 117, top_system_distance: int | float = 117)[source]
Bases:
XMLWrapper,LayoutMixin- XMLClass
alias of
XMLSystemLayout
- to_string(*args, **kwargs) str
XMLWrappermethodCalls
to_stringmethod of self.xml_object- Returns:
musicxml snippet
- property parent
- Returns:
musicscore object which uses this layout object.
Todo
Print implementation: At this moment only
Scoreis implemented.
- property system_distance: int | float | None
Set and get
valueofXMLSystemDistance.- Returns:
self.xml_object.xml_system_distance.value_- Return type:
int, float, None
- property top_system_distance: int | float | None
Set and get
valueofXMLTopSystemDistance.- Returns:
self.xml_object.xml_top_system_distance.value_- Return type:
int, float, None
- property xml_object: XMLElement
XMLWrappermethodThis musicscore class has an equivalent
MusicXMLclass which can be reached via this property.If an attribute is not found directly in the main class, it wll be passed on to
__get_attribute__or__set__attribute__methods ofself.xml_object. It can also use the short cut attributes ofXMLElementto get or set the first child.- Returns:
wrapped MusicXML element of type
XMLClass
- musicscore.layout.PAGE_MARGINS = {'A3': {'landscape': {'bottom': 70, 'left': 111, 'right': 70, 'top': 70}, 'portrait': {'bottom': 70, 'left': 111, 'right': 70, 'top': 70}}, 'A4': {'landscape': {'bottom': 70, 'left': 111, 'right': 70, 'top': 70}, 'portrait': {'bottom': 70, 'left': 140, 'right': 70, 'top': 70}}}
- musicscore.layout.PAGE_SIZES = {'A3': (297.0389, 419.9819), 'A4': (209.991, 297.0389)}
- musicscore.layout.SCALING = {'millimeters': 7.2319, 'tenths': 40}
- musicscore.layout.STAFF_LAYOUT = {'staff_distance': 80}
- musicscore.layout.SYSTEM_LAYOUT = {'system_distance': 117, 'top_system_distance': 117}
- musicscore.layout.SYSTEM_MARGINS = {'left': 0, 'right': 0}