[vtkusers] Re: timer example
Goodwin Lawlor
goodwin.lawlor at ucd.ie
Thu Nov 9 12:28:24 EST 2006
Dominik Szczerba wrote:
> According to the docu, the vtkHoverWidget is used to invoke an event when
> hovering in a render window. Do you propose to use a zero threshold to
> simulate an idle function? That sounds like an overkill for what I need. Iren
> allows for timers, is there really no way to regularly trigger arbitrary
> commands just like iren->AddObserver(vtkCommand::MouseMoveEvent, myCommand)
> does on a mouse movement?
Hi Dominik,
I meant vtkHoverWidget is the only that uses a repeating timer at the
moment. Here a (slightly buggy) but quick tcl example to illustrate:
package require vtk
wm withdraw .
set val 10
vtkTextActor txt
txt SetInput $val
txt SetMinimumSize 100 100
txt ScaledTextOn
vtkRenderer ren
ren AddActor txt
vtkRenderWindow renwin
renwin AddRenderer ren
vtkRenderWindowInteractor iren
iren SetRenderWindow renwin
iren Initialize
iren CreateRepeatingTimer 1000
iren AddObserver TimerEvent {if {$val == 0} exit}
iren AddObserver TimerEvent {txt SetInput [incr val -1]; txt
Modified; renwin Render}
hth
Goodwin
More information about the vtkusers
mailing list