pyvista.Plotter.add_sphere_widget#
- Plotter.add_sphere_widget(
- callback,
- center=(0, 0, 0),
- radius=0.5,
- theta_resolution=30,
- phi_resolution=30,
- color=None,
- style='surface',
- selected_color='pink',
- indices=None,
- pass_widget=False,
- test_callback=True,
- interaction_event=45,
Add one or many sphere widgets to a scene.
Use a sphere widget to control a vertex location.
- Parameters:
- callback
callable()
The function to call back when the widget is modified. It takes a single argument: the center of the sphere as an XYZ coordinate (a 3-length sequence), unless
pass_widget=True
, in which case the callback must accept the widget object as the second parameter. If multiple centers are passed in thecenter
parameter, the callback must also accept an index of that widget.- centersequence[
float
],optional
The cartesian coordinate of the sphere’s center when placing it in the scene. If more than one location is passed, then that many widgets will be added and the callback will also be passed the integer index of that widget.
- radius
float
,optional
The radius of the sphere.
- theta_resolution
int
,optional
Set the number of points in the longitude direction.
- phi_resolution
int
,optional
Set the number of points in the latitude direction.
- color
ColorLike
,optional
The color of the sphere’s surface. If multiple centers are passed, then this must be a list of colors. Each color is either a string, rgb list, or hex color string. For example:
color='white'
color='w'
color=[1.0, 1.0, 1.0]
color='#FFFFFF'
- style
str
,optional
Representation style:
'surface'
or'wireframe'
.- selected_color
ColorLike
,optional
Color of the widget when selected during interaction.
- indicessequence[
int
],optional
Indices to assign the sphere widgets.
- pass_widgetbool,
optional
If
True
, the widget will be passed as the last argument of the callback.- test_callbackbool,
optional
If
True
, run the callback function after the widget is created.- interaction_event
vtk.vtkCommand.EventIds
,optional
The VTK interaction event to use for triggering the callback.
- callback
- Returns:
vtk.vtkSphereWidget
The sphere widget.