add_box_widget

Plotter.add_box_widget(callback, bounds=None, factor=1.25, rotation_enabled=True, color=None, use_planes=False, outline_translation=True, pass_widget=False)

Add a box widget to the scene.

This is useless without a callback function. You can pass a callable function that takes a single argument, the PolyData box output from this widget, and performs a task with that box.

Parameters
callbackcallable()

The method called every time the box is updated. This has two options: Take a single argument, the PolyData box (default) or if use_planes=True, then it takes a single argument of the plane collection as a vtkPlanes object.

boundstuple(float)

Length 6 tuple of the bounding box where the widget is placed.

factorfloat, optional

An inflation factor to expand on the bounds when placing.

rotation_enabledbool, optional

If False, the box widget cannot be rotated and is strictly orthogonal to the cartesian axes.

colorstr or sequence, optional

Either a string, rgb sequence, or hex color string. Defaults to pyvista.global_theme.font.color.

use_planesbool, optional

Changes the arguments passed to the callback to the planes that make up the box.

outline_translationbool, optional

If False, the box widget cannot be translated and is strictly placed at the given bounds.

pass_widgetbool, optional

If True, the widget will be passed as the last argument of the callback.

Returns
vtk.vtkBoxWidget

Box widget.