vtkmodules.tk.vtkTkRenderWidget#

A simple vtkTkRenderWidget for tkinter.

Created by David Gobbi, April 1999

May ??, 1999 - Modifications performed by Heather Drury, to rewrite _pan to match method in TkInteractor.tcl May 11, 1999 - Major rewrite by David Gobbi to make the interactor bindings identical to the TkInteractor.tcl bindings. July 14, 1999 - Added modification by Ken Martin for VTK 2.4, to use vtk widgets instead of Togl. Aug 29, 1999 - Renamed file to vtkRenderWidget.py Nov 14, 1999 - Added support for keyword ‘rw’ Mar 23, 2000 - Extensive but backwards compatible changes, improved documentation

A few important notes:

This class is meant to be used as a base-class widget for doing VTK rendering in Python.

In VTK (and C++) there is a very important distinction between public ivars (attributes in pythonspeak), protected ivars, and private ivars. When you write a python class that you want to ‘look and feel’ like a VTK class, you should follow these rules.

  1. Attributes should never be public. Attributes should always be either protected (prefixed with a single underscore) or private (prefixed with a double underscore). You can provide access to attributes through public Set/Get methods (same as VTK).

  2. Use a single underscore to denote a protected attribute, e.g. self._RenderWindow is protected (can be accessed from this class or a derived class).

  3. Use a double underscore to denote a private attribute, e.g. self.__InExpose cannot be accessed outside of this class.

All attributes should be ‘declared’ in the init() function i.e. set to some initial value. Don’t forget that ‘None’ means ‘NULL’ - the python/vtk wrappers guarantee their equivalence.

Module Contents#

Classes#

vtkTkRenderWidget

A vtkTkRenderWidget for Python.

Functions#

vtkRenderWidgetConeExample

Like it says, just a simple example

API#

class vtkmodules.tk.vtkTkRenderWidget.vtkTkRenderWidget(master, cnf={}, **kw)#

Bases: tkinter.Widget

A vtkTkRenderWidget for Python.

Use GetRenderWindow() to get the vtkRenderWindow.

Create with the keyword stereo=1 in order to generate a stereo-capable window.

Create with the keyword focus_on_enter=1 to enable focus-follows-mouse. The default is for a click-to-focus mode.

Initialization

Constructor.

Keyword arguments:

rw – Use passed render window instead of creating a new one.

stereo – If True, generate a stereo-capable window. Defaults to False.

focus_on_enter – If True, use a focus-follows-mouse mode. Defaults to False where the widget will use a click-to-focus mode.

__getattr__(attr)#
BindTkRenderWidget()#

Bind some default actions.

GetZoomFactor()#
SetDesiredUpdateRate(rate)#

Mirrors the method with the same name in vtkRenderWindowInteractor.

GetDesiredUpdateRate()#

Mirrors the method with the same name in vtkRenderWindowInteractor.

SetStillUpdateRate(rate)#

Mirrors the method with the same name in vtkRenderWindowInteractor.

GetStillUpdateRate()#

Mirrors the method with the same name in vtkRenderWindowInteractor.

GetRenderWindow()#
GetPicker()#
Expose()#
Render()#
UpdateRenderer(x, y)#

UpdateRenderer will identify the renderer under the mouse and set up _CurrentRenderer, _CurrentCamera, and _CurrentLight.

GetCurrentRenderer()#
Enter(x, y)#
Leave(x, y)#
StartMotion(x, y)#
EndMotion(x, y)#
Rotate(x, y)#
Pan(x, y)#
Zoom(x, y)#
Reset(x, y)#
Wireframe()#
Surface()#
PickActor(x, y)#
vtkmodules.tk.vtkTkRenderWidget.vtkRenderWidgetConeExample()#

Like it says, just a simple example