Skip to content
Snippets Groups Projects
Commit cd9af1b5 authored by Andrew Maclean's avatar Andrew Maclean
Browse files

Minor updates to the documentation and a new image

parent 313cd8d9
No related branches found
No related tags found
1 merge request!392Minor updates to the documentation and a new image
Pipeline #426691 passed
File mode changed from 100644 to 100755
......@@ -2,6 +2,10 @@
Implement a 2D slider widget.
A vtkSliderRepresentation2D has a large number of properties. Most of these properties are defined in the dataclass: `Slider2DProperties`. It is best to create a function `def make_slider_properties():` that will be used to set up the slider with your preferred values for the parameters. If there are multiple sliders in your application then it is easy to modify the slider properties returned from this function as needed.
This is the approach adopted in [Slider2D](../../Widgets/Slider2D) and [KochanekSplineDemo](../../PolyData/KochanekSplineDemo).
To use the snippet, click the *Copy to clipboard* at the upper right of the code blocks.
### Implementation
......@@ -165,16 +169,3 @@ class SliderCallback:
### Usage
For examples showing the usage of this snippet and changing most of the default parameters, please see: [Slider2D](../../Widgets/Slider2D) and [KochanekSplineDemo](../../PolyData/KochanekSplineDemo).
``` Python
...
sp = Slider2DProperties()
sp.title_text = 'Sphere Resolution'
sp.Range.value = 5
...
widget = make_2d_slider_widget(sp, render_window_interactor)
cb = SliderCallback(sphere_source)
widget.AddObserver(vtkCommand.InteractionEvent, cb)
...
```
......@@ -2,6 +2,10 @@
Implement a 3D slider widget.
A vtkSliderRepresentation3D has a large number of properties. Most of these properties are defined in the dataclass: `Slider3DProperties`. It is best to create a function `def make_slider_properties():` that will be used to set up the slider with your preferred values for the parameters. If there are multiple sliders in your application then it is easy to modify the slider properties returned from this function as needed.
This is the approach adopted in [Slider3D](../../Widgets/Slider3D).
To use the snippet, click the *Copy to clipboard* at the upper right of the code blocks.
### Implementation
......@@ -126,16 +130,3 @@ class SliderCallback:
### Usage
For an example showing the usage of this snippet and changing most of the default parameters, please see: [Slider3D](../../Widgets/Slider3D).
``` Python
...
sp = Slider2DProperties()
sp.title_text = 'Sphere Resolution'
sp.Range.value = 8
...
widget = make_3d_slider_widget(sp, render_window_interactor)
cb = SliderCallback(sphere_source)
widget.AddObserver(vtkCommand.InteractionEvent, cb)
...
```
......@@ -10,6 +10,7 @@ import vtkmodules.vtkRenderingOpenGL2
from vtkmodules.vtkCommonColor import vtkNamedColors
from vtkmodules.vtkCommonCore import vtkCommand
from vtkmodules.vtkFiltersSources import vtkSphereSource
from vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera
from vtkmodules.vtkInteractionWidgets import (
vtkSliderRepresentation2D,
vtkSliderWidget
......@@ -46,6 +47,8 @@ def main():
# An interactor.
render_window_interactor = vtkRenderWindowInteractor()
render_window_interactor.render_window = render_window
style = vtkInteractorStyleTrackballCamera()
render_window_interactor.interactor_style = style
# Add the actors to the scene.
renderer.AddActor(actor)
......
......@@ -10,6 +10,7 @@ import vtkmodules.vtkRenderingOpenGL2
from vtkmodules.vtkCommonColor import vtkNamedColors
from vtkmodules.vtkCommonCore import vtkCommand
from vtkmodules.vtkFiltersSources import vtkSphereSource
from vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera
from vtkmodules.vtkInteractionWidgets import (
vtkSliderRepresentation3D,
vtkSliderWidget
......@@ -49,6 +50,8 @@ def main():
# An interactor.
render_window_interactor = vtkRenderWindowInteractor()
render_window_interactor.render_window = render_window
style = vtkInteractorStyleTrackballCamera()
render_window_interactor.interactor_style = style
# Add the actors to the scene.
renderer.AddActor(actor)
......@@ -57,7 +60,7 @@ def main():
render_window.Render()
sp = make_slider_properties()
sp.Range.value = sphere_source.theta_resolution
sp.Text.title = 'Sphere Resolution'
......
src/Testing/Baseline/PythonicAPI/PolyData/TestKochanekSplineDemo.png

130 B | W: | H:

src/Testing/Baseline/PythonicAPI/PolyData/TestKochanekSplineDemo.png

130 B | W: | H:

src/Testing/Baseline/PythonicAPI/PolyData/TestKochanekSplineDemo.png
src/Testing/Baseline/PythonicAPI/PolyData/TestKochanekSplineDemo.png
src/Testing/Baseline/PythonicAPI/PolyData/TestKochanekSplineDemo.png
src/Testing/Baseline/PythonicAPI/PolyData/TestKochanekSplineDemo.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment