[vtkusers] Documentation for event callback return values?

Elvis Stansvik elvis.stansvik at orexplore.com
Thu Jun 16 02:31:33 EDT 2016


Den 15 juni 2016 5:45 em skrev "David Gobbi" <david.gobbi at gmail.com>:
>
> 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.

Excellent. I had my suspicion it might have been a mistake, thanks for
doing the digging.

Elvis

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


More information about the vtkusers mailing list