pyvista.Light.copy#

Light.copy(deep=True)[source]#

Return a shallow or a deep copy of the light.

The only mutable attribute of pyvista.Light is the transformation matrix (if it exists). Thus asking for a shallow copy merely implies that the returned light and the original share the transformation matrix instance.

Parameters:
deepbool, default: True

Whether to return a deep copy rather than a shallow one.

Returns:
pyvista.Light

Copied light.

Examples

Create a light and check that it shares a transformation matrix with its shallow copy.

>>> import pyvista as pv
>>> light = pv.Light()
>>> light.transform_matrix = [
...     [1, 0, 0, 0],
...     [0, 1, 0, 0],
...     [0, 0, 1, 0],
...     [0, 0, 0, 1],
... ]
>>> shallow_copied = light.copy(deep=False)
>>> shallow_copied == light
True
>>> shallow_copied.transform_matrix is light.transform_matrix
True