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.


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). If multiple centers are passed in the center parameter, the callback must also accept an index of that widget.

centertuple(float), optional

Length 3 array for the XYZ 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.

radiusfloat, optional

The radius of the sphere.

theta_resolutionint, optional

Set the number of points in the longitude direction.

phi_resolutionint, optional

Set the number of points in the latitude direction.

colorcolor_like, 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'

stylestr, optional

Representation style: 'surface' or 'wireframe'.

selected_colorcolor_like, optional

Color of the widget when selected during interaction.

indicessequence, 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_eventvtk.vtkCommand.EventIds, optional

The VTK interaction event to use for triggering the callback.


The sphere widget.