pyvista.vtk_verbosity

Contents

pyvista.vtk_verbosity#

vtk_verbosity = <pyvista.core.utilities.state_manager._VTKVerbosity object>#

Context manager to set VTK verbosity level.

Added in version 0.45.

Parameters:
verbositystr

Verbosity of the vtkLogger to set.

  • 'off': No output.

  • 'error': Only error messages.

  • 'warning': Errors and warnings.

  • 'info': Errors, warnings, and info messages.

  • 'max': All messages, including debug info.

Examples

Get the current vtk verbosity.

>>> import pyvista as pv
>>> pv.vtk_verbosity()
'info'

Set verbosity to max.

>>> _ = pv.vtk_verbosity('max')
>>> pv.vtk_verbosity()
'max'

Create a Sphere(). Note how many VTK debugging messages are now generated as the sphere is created.

>>> mesh = pv.Sphere()

Use it as a context manager to temporarily turn it off.

>>> with pv.vtk_verbosity('off'):
...     mesh = mesh.cell_quality('volume')

The state is restored to its previous value outside the context.

>>> pv.vtk_verbosity()
'max'

Note that the verbosity state is global and will persist between function calls. If the context manager isn’t used, the state needs to be reset explicitly. Here, we set it back to its default value.

>>> _ = pv.vtk_verbosity('info')