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)

Add one or many sphere widgets to a scene.

Use a sphere widget to control a vertex location.

Parameters
callbackcallable()

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.

colorstr or 3 item iterable, 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, 1, 1]

  • color='#FFFFFF'

stylestr, optional

Representation style: 'surface' or 'wireframe'.

selected_colorstr, 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.

Returns
vtk.vtkSphereWidget

The sphere widget.