enable_surface_picking#
- Plotter.enable_surface_picking(callback=None, show_message=True, font_size=18, color='pink', show_point=True, point_size=10, tolerance=0.025, pickable_window=False, left_clicking=False, **kwargs)#
Enable picking of a mesh.
- Parameters
- callback
function
,optional
When input, calls this function after a selection is made. The
mesh
is input as the first parameter to this function.- show_messagebool or
str
,optional
Show the message about how to use the mesh picking tool. If this is a string, that will be the message shown.
- font_size
int
,optional
Sets the font size of the message.
- color
color_like
,optional
The color of the selected mesh when shown.
- show_pointbool,
optional
Show the selection interactively. Default
True
.- point_size
int
,optional
Size of picked points if
show_point
isTrue
. Default 10.- tolerance
float
,optional
Specify tolerance for performing pick operation. Tolerance is specified as fraction of rendering window size. Rendering window size is measured across diagonal.
- pickable_windowbool,
optional
When
True
, points in the 3D window are pickable. Default toFalse
.- left_clickingbool,
optional
When
True
, meshes can be picked by clicking the left mousebutton. Default toFalse
.Note
If enabled, left-clicking will not display the bounding box around the picked mesh.
- **kwargs
dict
,optional
All remaining keyword arguments are used to control how the picked path is interactively displayed.
- callback
- Returns
vtk.vtkPropPicker
Property picker.
Examples
Add a cube to a plot and enable cell picking. Enable
left_clicking
to immediately start picking on the left click and disable showing the box. You can still press thep
key to select meshes.>>> import pyvista as pv >>> cube = pv.Cube() >>> pl = pv.Plotter() >>> _ = pl.add_mesh(cube) >>> _ = pl.enable_surface_picking(left_clicking=True)
See Picking a Point on the Surface of a Mesh for a full example using this method.