File: python.md

package info (click to toggle)
vtk9 9.5.2%2Bdfsg4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 206,640 kB
  • sloc: cpp: 2,340,827; ansic: 327,116; python: 114,881; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; javascript: 1,261; makefile: 194; objc: 153; tcl: 59
file content (67 lines) | stat: -rw-r--r-- 2,395 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Python

## Native Python documentation
Python-style documentation is available for the following packages:

```{toctree}
:titlesonly:
:maxdepth: 2

python/vtkmodules/vtkmodules
```

## Doxygen-style documentation
VTK is implemented in C++ and it is made available in Python via its Python Wrappers.
Although, the VTK doxygen [documentation](http://vtk.org/doc/nightly/html) is derived from the C++ API, the corresponding Python API uses the same classes and methods.
There are however some conventions in place for how wrapping is constructed. To quickly inspect the available methods of a class you can use the `help` method:
```python
>> import vtk
help(vtk.vtkSphereSource)

Help on vtkSphereSource object:

class vtkSphereSource(vtkmodules.vtkCommonExecutionModel.vtkPolyDataAlgorithm)
 |  vtkSphereSource - create a polygonal sphere centered at the origin
 |
 |  Superclass: vtkPolyDataAlgorithm
 |
 |  vtkSphereSource creates a sphere (represented by polygons) of
 |  specified radius centered at the origin. The resolution (polygonal
 |  discretization) in both the latitude (phi) and longitude (theta)
 |  directions can be specified. It also is possible to create partial
 |  spheres by specifying maximum phi and theta angles. By default, the
 |  surface tessellation of the sphere uses triangles; however you can
 |  set LatLongTessellation to produce a tessellation using
 |  quadrilaterals.
 |
 |  @warning
 |  Resolution means the number of latitude or longitude lines for a
 |  complete sphere. If you create partial spheres the number of
 |  latitude/longitude lines may be off by one.
 |
 |  Method resolution order:
 |      vtkSphereSource
 |      vtkmodules.vtkCommonExecutionModel.vtkPolyDataAlgorithm
 |      vtkmodules.vtkCommonExecutionModel.vtkAlgorithm
 |      vtkmodules.vtkCommonCore.vtkObject
 |      vtkmodules.vtkCommonCore.vtkObjectBase
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  GenerateNormalsOff(...)
 |      GenerateNormalsOff(self) -> None
 |      C++: virtual void GenerateNormalsOff()
 |
 |  GenerateNormalsOn(...)
 |      GenerateNormalsOn(self) -> None
 |      C++: virtual void GenerateNormalsOn()
 |
 |  GetCenter(...)
 |      GetCenter(self) -> (float, float, float)
 |      C++: virtual double *GetCenter()
...
```


For a more in-depth description of the Python Wrappers see the dedicated [section](../advanced/PythonWrappers.md).