enable_mesh_picking#

Plotter.enable_mesh_picking(callback=None, show=True, show_message=True, style='wireframe', line_width=5, color='pink', font_size=18, left_clicking=False, **kwargs)#

Enable picking of a mesh.

Parameters
callbackfunction, optional

When input, calls this function after a selection is made. The mesh is input as the first parameter to this function.

showbool, optional

Show the selection interactively. Best when combined with left_clicking.

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.

stylestr, optional

Visualization style of the selection. Defaults to 'wireframe'. One of the following:

  • 'surface'

  • 'wireframe'

  • 'points'

line_widthfloat, optional

Thickness of selected mesh edges. Default 5.

colorcolor_like, optional

The color of the selected mesh when shown.

font_sizeint, optional

Sets the font size of the message.

left_clickingbool, optional

When True, meshes can be picked by clicking the left mousebutton. Default to False.

Note

If enabled, left-clicking will not display the bounding box around the picked point.

**kwargsdict, optional

All remaining keyword arguments are used to control how the picked path is interactively displayed.

Returns
vtk.vtkPropPicker

Property picker.

Examples

Add a sphere and a cube to a plot and enable mesh picking. Enable left_clicking to immediately start picking on the left click and disable showing the box. You can still press the p key to select meshes.

>>> 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_mesh_picking(left_clicking=True)

See Picking Meshes for a full example using this method.

../../../_images/pyvista-Plotter-enable_mesh_picking-1_00_00.png