# Custom Events for VTK

**URL:** <https://discourse.slicer.org/t/custom-events-for-vtk/1286>\
**Category:** Support\
**Created:** [October 25, 2017, 5:41pm UTC](https://discourse.slicer.org/t/custom-events-for-vtk/1286 "2017-10-25T17:41:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [October 25, 2017, 8:28pm UTC](https://discourse.slicer.org/t/custom-events-for-vtk/1286/3 "2017-10-25T20:28:33Z")

</div>

For some types of data can add a decorator to your callback that interprets the call data in python.

[https://github.com/Kitware/VTK/blob/master/Wrapping/Python/vtk/util/misc.py#L6-L27](https://github.com/Kitware/VTK/blob/master/Wrapping/Python/vtk/util/misc.py#L6-L27)

For most data types in Slicer, a vtkObject is actually returned as a wrapped version of whatever concrete subclass was passed in the payload, so it actually covers all slicer events that come from nodes or the scene or other classes.

> <https://github.com/Slicer/Slicer/blob/ee5c8703642cf8f42e9594bc780cb0801623b39d/Modules/Scripted/DICOMLib/DICOMWidgets.py#L828-L832>

You can also call InvokeEvent from python with a calldata (payload) argument.

In practice it’s often the case in Slicer that you don’t need calldata because knowing the caller is enough to get the information you want because what would otherwise be the payload data has already been set in the corresponding instance variable of the caller.

---

_[View the full topic](https://discourse.slicer.org/t/custom-events-for-vtk/1286)._
