Skip to content

Commit

Permalink
Add fix for pyvista#3224
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbr committed Dec 28, 2022
1 parent 49f45ef commit 0782d3b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pyvista/_vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,20 @@
vtkSplineWidget,
vtkTexturedButtonRepresentation2D,
)
from vtkmodules.vtkPythonContext2D import vtkPythonItem

try:
from vtkmodules.vtkPythonContext2D import vtkPythonItem
except ImportError: # pragma: no cover
# `vtkmodules.vtkPythonContext2D` is unavailable in some versions of `vtk` (see #3224)
class vtkPythonItem: # type: ignore
"""Empty placeholder."""

def __init__(self): # pragma: no cover
"""Raise version error on init."""
from pyvista.core.errors import VTKVersionError

raise VTKVersionError('Chart backgrounds require the vtkPythonContext2D module')

from vtkmodules.vtkRenderingAnnotation import (
vtkAnnotatedCubeActor,
vtkAxesActor,
Expand Down

0 comments on commit 0782d3b

Please sign in to comment.