Skip to content

MgList

Auto-generated documentation for musicalgestures._mglist module.

MgList

[find in source code]

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__

[find in source code]

def __add__(other):

Implements +.

Arguments

  • other MgImage/MgFigure/MgList - The object(s) to add to the MgList.

Returns

  • MgList - The incremented MgList.

MgList().__delitem__

[find in source code]

def __delitem__(key):

Implements deleting elements given an index from the MgList.

Arguments

  • key int - The index of the element to delete.

MgList().__getitem__

[find in source code]

def __getitem__(key):

Implements getting elements given an index from the MgList.

Arguments

  • key int - The index of the element to retrieve.

Returns

  • MgImage/MgFigure/MgList - The element at key.

MgList().__iadd__

[find in source code]

def __iadd__(other):

Implements +=.

Arguments

  • other MgImage/MgFigure/MgList - The object(s) to add to the MgList.

Returns

  • MgList - The incremented MgList.

MgList().__iter__

[find in source code]

def __iter__():

Implements iter().

Returns

  • iterator - The iterator of self.objectlist.

MgList().__len__

[find in source code]

def __len__():

Implements len().

Returns

  • int - The length of the MgList.

MgList().__setitem__

[find in source code]

def __setitem__(key, value):

Implements setting elements given an index from the MgList.

Arguments

  • key int - The index of the element to change.
  • value MgImage/MgFigure/MgList - The element to place at key.

MgList().as_figure

[find in source code]

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

  • dpi int, optional - Image quality of the rendered figure in DPI. Defaults to 300.
  • autoshow bool, optional - Whether to show the resulting figure automatically. Defaults to True.
  • title str, optional - Optionally add a title to the figure. Defaults to None (no title).
  • export_png bool, 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

[find in source code]

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.