# Issue with vtk.vtkCommand.HoverEvent on vtk.vtkHandleWidget

**URL:** <https://discourse.slicer.org/t/issue-with-vtk-vtkcommand-hoverevent-on-vtk-vtkhandlewidget/41159>\
**Category:** Development\
**Tags:** vtk, python\
**Created:** [January 20, 2025, 7:53am UTC](https://discourse.slicer.org/t/issue-with-vtk-vtkcommand-hoverevent-on-vtk-vtkhandlewidget/41159 "2025-01-20T07:53:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhan1245](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhan1245/32/69457_2.png) [@jhan1245](https://discourse.slicer.org/u/jhan1245)\
**Post date:** [January 20, 2025, 7:53am UTC](https://discourse.slicer.org/t/issue-with-vtk-vtkcommand-hoverevent-on-vtk-vtkhandlewidget/41159/1 "2025-01-20T07:53:32Z")

</div>

I am currently working with the vtk.vtkHandleWidget and attempting to add the vtk.vtkCommand.HoverEvent using the AddObserver method. However, it seems that the hover event is not functioning as expected.

Could you provide guidance on the necessary code or steps required to enable the hover event for a custom handle widget created with vtk.vtkHandleWidget? Any assistance or advice would be greatly appreciated.

```python

def createHandle(self):
    self.sphereRep, self.sphereHandle = self._createSphereHandle()

    # connect Hover Event
    self.sphereHandle.AddObserver(vtk.vtkCommand.HoverEvent, self.handleHoverEventCallback)

# Create Handle
def _createSphereHandle(self):
    handleSphereSource = vtk.vtkSphereSource()
    handleSphereSource.SetRadius(self.sphereRadius)
    handleSphereSource.SetThetaResolution(self.sphereResolution)
    handleSphereSource.SetPhiResolution(self.sphereResolution)
    handleSphereSource.Update()
    self.spherePoly = handleSphereSource.GetOutput()
   
    sphereRep = vtk.vtkPolygonalHandleRepresentation3D()
    sphereRep.SetHandle(self.spherePoly)
    sphereRep.GetProperty().SetColor(self.sphereColor)
    sphereRep.GetSelectedProperty().SetColor(self.sphereColor)
    sphereRep.GetProperty().SetAmbient(0.2)
    sphereRep.GetSelectedProperty().SetAmbient(0.2)

    sphereHandle = vtk.vtkHandleWidget()
    sphereHandle.SetInteractor(self.interactor)
    sphereHandle.SetRepresentation(sphereRep)
    sphereHandle.SetPriority(1.0)
    sphereHandle.SetAllowHandleResize(False)

    return sphereRep, sphereHandle

def handleHoverEventCallback(self, caller, event):
    print("mouse hover")

```

Thank you in advance for your time and support.

Best regards
