[vtkusers] Timers in wxPython VTK application

Santosh Biradar scbiradar at gmail.com
Fri Sep 7 08:50:09 EDT 2018


Hi VTKers,

I am working on a windows wxPython VTK application . VTK version is 6.3.0
I am trying to add repeating timer(s) to the renderwindowinteractor.
Now, I notice that the wxVTKRenderWindowInteractor class does not have
provision to specify the timer duration and always sets timer duration as
the default 10 ms.

I was able to add the duration as below (in the try except block):

def CreateTimer(self, obj, evt):
    """ Creates a timer.
    """
    self._timer = EventTimer(self)
    try:
        # From the docs
        # These methods are used to communicate information about the
currently firing CreateTimerEvent or DestroyTimerEvent.The caller of
CreateTimerEvent sets up TimerEventId, TimerEventType and
TimerEventDuration.
        duration = self._Iren.GetTimerEventDuration()
    except:
        duration = 10
    self._timer.Start(duration, True)


This works for me if I have a single timer. I want to know if there is
provision to create multiple interactor timers simultaneously.
If I have multiple timers with potentially different durations, how do
I know in my observer for TimerEvent, that the event is invoked from
which timer.

 As seen below, the timer Id is not passed in the Notify method of the
wxTimer subclass used in this module.

def Notify(self,*args,**kwargs):
    """ The timer has expired.
    """
    self.iren.TimerEvent()

 I would assume this could be an issue for Qt applications as well.


Thanks,
Santosh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180907/d57b217a/attachment.html>


More information about the vtkusers mailing list