Enable rectangle based picking at cells.

Press "r" to enable rectangle based selection. Press "r" again to turn it off.

Picking with the rectangle selection tool provides two values that are passed as the RectangleSelection object in the callback:

  1. RectangleSelection.viewport: the viewport coordinates of the selection rectangle.

  2. RectangleSelection.frustum: the full frustum made from the selection rectangle into the scene.

callbackcallable(), optional

When input, calls this callable after a selection is made. The RectangleSelection is the only passed argument containing the viewport coordinates of the selection and the projected frustum.

show_messagebool | str, default: True

Show the message about how to use the cell picking tool. If this is a string, that will be the message shown.

font_sizeint, default: 18

Sets the font size of the message.

startbool, default: True

Automatically start the cell selection tool.

show_frustumbool, default: False

Show the frustum in the scene.

stylestr, default: “wireframe”

Visualization style of the selection frustum. One of the following: style='surface', style='wireframe', or style='points'.

colorColorLike, default: “pink”

The color of the selected frustum when shown.

**kwargsdict, optional

All remaining keyword arguments are used to control how the selection frustum is interactively displayed.


Add a mesh and a cube to a plot and enable cell picking.

>>> import pyvista as pv
>>> mesh = pv.Sphere(center=(1, 0, 0))
>>> cube = pv.Cube()
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(mesh)
>>> _ = pl.add_mesh(cube)
>>> _ = pl.enable_rectangle_picking()