[vtkusers] Documentation for event callback return values?

David Gobbi david.gobbi at gmail.com
Wed Jun 15 11:45:11 EDT 2016


On Wed, Jun 15, 2016 at 9:30 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> On Wed, Jun 15, 2016 at 9:27 AM, David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> On Wed, Jun 15, 2016 at 7:51 AM, Elvis Stansvik <
>> elvis.stansvik at orexplore.com> wrote:
>>
>>> Hi all,
>>>
>>> I noticed in QVTKRenderWindowInteractor that it returns 1 in the
>>> callback it sets up for DestroyTimerEvent:
>>>
>>>     def DestroyTimer(self, obj, evt):
>>>         self._Timer.stop()
>>>         return 1
>>>
>>> So I suspect callbacks for this event are expected to return something.
>>> But I can't find any info in the docs on which event callbacks are expected
>>> to return something (and what), and which are not. Is this info available
>>> somewhere?
>>>
>>
>> I checked the code for the Execute command in vtkPythonCommand.cxx, and
>> the return value for callbacks is ignored.  So I'm not sure why this
>> callback returns a value.  Prabhu might remember (he wrote the function),
>> but that was way back in 2002.  It was probably a simple mistake due to
>> cut-and-paste.
>>
>> If anything, a non-negative return value would indicate that the callback
>> had aborted, e.g. that the callback did not complete whatever action it was
>> meant to perform.  But obviously that's not the intent for this method.
>>
>
> Small typo in the above: I meant non-zero, not non-negative.
>

Actually, please completely ignore the second paragraph that I wrote, it
just muddies what should be a clear statement:

When you use VTK events in python, the callback's return value is ignored.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160615/dbdf5d4a/attachment.html>


More information about the vtkusers mailing list