add_box_widget#
- WidgetHelper.add_box_widget(callback, bounds=None, factor=1.25, rotation_enabled=True, color=None, use_planes=False, outline_translation=True, pass_widget=False)[source]#
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
- callback
callable()
The method called every time the box is updated. This has two options: Take a single argument, the
PolyData
box (default) or ifuse_planes=True
, then it takes a single argument of the plane collection as avtkPlanes
object.- bounds
tuple
(float
) Length 6 tuple of the bounding box where the widget is placed.
- factor
float
,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.- color
color_like
,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.
- callback
- Returns
vtk.vtkBoxWidget
Box widget.