[slicer-users] Timers in Python Interactive Modules

Daniel Haehn haehn at bwh.harvard.edu
Thu Jan 21 08:35:58 EST 2010


Hi Ali,

I once used Python callbacks in connection with a vtkKWWizard.

Here is a code snippet:

...
self._wizardStepOne.SetShowUserInterfaceCommand(self.vtkScriptedModuleGUI,"Invoke
ShowUserInterface")

or you could pass arguments

self._wizardStepOne.SetShowUserInterfaceCommand(self.vtkScriptedModuleGUI,
"Invoke ShowUserInterface 'test'")

ShowUserInterface is just defined in the gui class as a
normal python method.
...

Maybe you can use something similar in connection with a timer.

HTH,
Daniel

On Wed, 20 Jan 2010 20:03:40 -0500, Ali Uneri <ali.uneri at jhu.edu> wrote:
> Hello,
> 
> I'm trying to develop a Slicer Interactive module in Python, where I
> require to perform a periodic task which will in turn update the
> module. More specifically a value is read from an external device,
> after which both the GUI and scene will need to be updated.
> 
> I've used vtkKWTkUtilities::CreateTimerHandler in the C++
> implementation of the module, however could not use this in Python as
> (I suspect) the last argument which takes the callback method as a
> string is not recognized in Python, i.e.
> 
> self.utility = slicer.vtkKWTkUtilities()
> self.utility.CreateTimerHandler(self.GetApplication(), self.Interval,
> self, "ProcessTimerEvents")
> 
> Is there another way to define such callback functions in Python?
> Better yet, is there a way to generate timer events and utilize the
> GUI observers?
> 
> Thank you,
> Ali
> _______________________________________________
> slicer-users mailing list
> slicer-users at bwh.harvard.edu
> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
> To unsubscribe: send email to
> slicer-users-request at massmail.spl.harvard.edu with unsubscribe as the
> subject




More information about the slicer-users mailing list