[vtkusers] CreateRepeatingTimer Loop with memory

David Gobbi david.gobbi at gmail.com
Wed Nov 21 08:35:21 EST 2018


Hi Marco,

Yes, global variables could be used here, but global variables are evil ;)

The issue with vtkInteractorStyleTrackballInteractor sounded familiar, so I
searched the bugtracker:
https://gitlab.kitware.com/vtk/vtk/issues/15966
http://vtk.1045678.n5.nabble.com/interaction-problem-after-timer-added-td5736076.html
I just tried the code listed in the discussion, it looks like the bug is
still present in VTK.

  David


On Wed, Nov 21, 2018 at 3:54 AM mmusy <marco.musy at gmail.com> wrote:

> ..maybe it's "dirty" but one may achieve the same with using global
> variables
> (var in the example).
>
> BTW, the vtkInteractorStyleTrackballCamera has a weird behaviour in
> rotating
> the scene.
>
>
>
> from __future__ import print_function
> import vtk
>
> var = 0
>
> class vtkTimerCallback():
>    def __init__(self):
>        self.timer_count = 0
>
>    def execute(self,obj,event):
>        global var
>        print(self.timer_count, var)
>        self.actor.SetPosition(self.timer_count, self.timer_count,0);
>        iren = obj
>        iren.GetRenderWindow().Render()
>        self.timer_count += 1
>        var += 1
>
> def main():
> ...
>
>
> if __name__ == '__main__':
>    main()
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181121/e0b350b4/attachment.html>


More information about the vtkusers mailing list