[vtkusers] Handling "out" pointer callData parameters in events from Python

Elvis Stansvik elvis.stansvik at orexplore.com
Sun Jun 26 04:08:15 EDT 2016

2016-06-23 16:26 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:

> Hi all,
> I'm trying to make a QOpenGLWidget based VTK widget, and I'm taking
> inspiration from QVTKWidget2 and this stack overflow answer:
>     http://stackoverflow.com/a/26946040/252857
> which provides a QVTKWidget3 based on QOpenGLWidget.
> Given how QVTKWidget2 handles IsCurrentEvent, IsDirectEvent and
> SupportsOpenGLEvent from the render window [1], e.g:
> void QVTKWidget2::IsCurrent(vtkObject*, unsigned long, void*, void*
> call_data)
> {
>   bool* ptr = reinterpret_cast<bool*>(call_data);
>   *ptr = QGLContext::currentContext() == this->context();
> }
> Is there any way to do this operation from Python? I know there's some
> support for callData, but how would I effect a write to the memory pointed
> at by the call_data parameter like this from Python?
> If it's not possible, am I completely doomed in trying to make a Python
> class similar to QVTKWidget2?

Noone knows?

David Gobbi, I think you worked on calldata support for Python (?), do you
know if it's currently impossible to handle these events correctly from
Python? (since they expect an answer through a memory write).

I find these events quite strange actually. An event to me is something you
fire and forget, not a request for information like these ones seems to be.
Anyone know why the API was built like this?


> Many thanks in advance,
> Elvis
> [1]
> https://gitlab.kitware.com/vtk/vtk/blob/master/GUISupport/QtOpenGL/QVTKWidget2.cxx#L458-474
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160626/76a84b92/attachment.html>

More information about the vtkusers mailing list