[vtkusers] Aborting observers in python

Wayne Christopher wayne at 4raccoons.com
Thu Sep 22 16:20:16 EDT 2011


Yes, that does seem to work.  I can get the command in this way and call 
command.SetAbortFlag(1) to stop further processing.  Maybe this can be 
changed in the next release?

Thanks!

     Wayne

On 9/22/11 8:59 AM, David Gobbi wrote:
> Hi Wayne,
>
> Around a year ago I did a little bit of work on improving vtkCommand
> in python, but it has been low priority.  It might be possible to
> access a command object in python if you are willing to play with the
> VTK source code a bit.
>
> In Wrapping/vtkWrapPython.c remove the following line and recompile VTK:
>
> 3090:          (strcmp(theFunc->Name, "GetCommand") == 0) ||
>
> Then try adding an observer in python and retrieving the command object:
>
> commandID = obj.AddObserver(eventID, callback)
> command = obj.GetCommand(commandID)
>
> If this works for you, then let me know.
>
>   - David
>
>
>
> On Wed, Sep 21, 2011 at 4:12 PM, Wayne Christopher<wayne at 4raccoons.com>  wrote:
>> I saw a discussion from a few years ago -
>> http://www.vtk.org/pipermail/vtk-developers/2007-September/004725.html -
>> about setting the abort flag in an observer to prevent further observers
>> from being fired with the python bindings.
>>
>> Has anything been done about this?  I couldn't quite tell from the
>> discussion whether there was a workaround or not.
>>
>> Thanks,
>>
>>     Wayne



More information about the vtkusers mailing list