MgList
Auto-generated documentation for musicalgestures._mglist module.
- Mgt-python / Modules / Musicalgestures / MgList
MgList
class MgList():
def __init__(*objectlist):
Class for handling lists of MgImage, MgFigure and MgList objects in the Musical Gestures Toolbox.
Attributes
- *objectlist : objects and/or list(s) of objects
MgObjects and/or MgImages to include in the list.
MgList().__add__
def __add__(other):
Implements +.
Arguments
otherMgImage/MgFigure/MgList - The object(s) to add to the MgList.
Returns
MgList- The incremented MgList.
MgList().__delitem__
def __delitem__(key):
Implements deleting elements given an index from the MgList.
Arguments
keyint - The index of the element to delete.
MgList().__getitem__
def __getitem__(key):
Implements getting elements given an index from the MgList.
Arguments
keyint - The index of the element to retrieve.
Returns
MgImage/MgFigure/MgList- The element atkey.
MgList().__iadd__
def __iadd__(other):
Implements +=.
Arguments
otherMgImage/MgFigure/MgList - The object(s) to add to the MgList.
Returns
MgList- The incremented MgList.
MgList().__iter__
def __iter__():
Implements iter().
Returns
iterator- The iterator ofself.objectlist.
MgList().__len__
def __len__():
Implements len().
Returns
int- The length of the MgList.
MgList().__setitem__
def __setitem__(key, value):
Implements setting elements given an index from the MgList.
Arguments
keyint - The index of the element to change.valueMgImage/MgFigure/MgList - The element to place atkey.
MgList().as_figure
def as_figure(dpi=300, autoshow=True, title=None, export_png=True):
Creates a time-aligned figure from all the elements in the MgList.
Arguments
dpiint, optional - Image quality of the rendered figure in DPI. Defaults to 300.autoshowbool, optional - Whether to show the resulting figure automatically. Defaults to True.titlestr, optional - Optionally add a title to the figure. Defaults to None (no title).export_pngbool, optional - Whether to export a png image of the resulting figure automatically. Defaults to True.
Returns
MgFigure- The MgFigure with all the elements from the MgList as layers.
MgList().show
def show(
filename=None,
key=None,
mode='windowed',
window_width=640,
window_height=480,
window_title=None,
):
Iterates all objects in the MgList and calls mg_show() on them.