# Trouble interacting with contextviews on viewports

**URL:** https://discourse.vtk.org/t/trouble-interacting-with-contextviews-on-viewports/8554
**Category:** Support
**Tags:** python
**Created:** [May 23, 2022, 9:55am UTC](https://discourse.vtk.org/t/trouble-interacting-with-contextviews-on-viewports/8554 "2022-05-23T09:55:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Afonso\_Pinto](https://discourse.vtk.org/user_avatar/discourse.vtk.org/afonso_pinto/32/5191_2.png) [@Afonso\_Pinto](https://discourse.vtk.org/u/Afonso_Pinto)
#### Post date: [May 23, 2022, 9:55am UTC](https://discourse.vtk.org/t/trouble-interacting-with-contextviews-on-viewports/8554/1 "2022-05-23T09:55:47Z")

</div>

Hello everyone,

I’m trying to implement a VTK widget that is supposed to display various charts on different viewports and I would like for the user to be able to get the tooltip that displays the information about the bar the cursor is currently hovering above. However the trouble I am running into is that I am only able to get information about the last viewport by interacting with the renderer that was made before as you can see in this image (cursor is ate where red arrow is):

 ![wrong interaction](https://discourse.vtk.org/uploads/default/original/2X/8/896d2a32868cfde8552419c3b5bfbbc6617d4918.png)

I am using python-VTK and I am displaying the renderwindow in a PyQt widget. My code is as follows:

```auto
            self.vtkWidget_c = QVTKRenderWindowInteractor(self.fpga_tabs_c)

            self.layout_vtk_c.addWidget(self.vtkWidget_c[i])

            self.list_of_renderers_c = [None]*4
            pos=[[0, 0.5, 0, 0.5],
                 [0.5, 0.5, 0, 0],
                 [0.5, 1, 0.5, 1],
                 [1, 1, 0.5, 0.5]]
            for idx in range(len(self.list_of_renderers_c[i])):
                self.list_of_renderers_c[idx] = vtk.vtkContextView()
                self.list_of_renderers_c[idx].GetRenderer().SetViewport(pos[0][idx],
                                                 pos[idx],
                                                 pos[idx],
                                                 pos[idx])

                self.list_of_renderers_c[idx].SetRenderWindow(self.vtkWidget_c[i].GetRenderWindow())

           # Code to render graphs goes here. 

            self.vtkWidget_c.show()
            self.vtkWidget_c.Initialize()
            self.vtkWidget_c.Start()

```

I understand that it has something to do with the interactor for the renderwindow. But I cannot find another way to implement it. I would expect that I would need to create a custom interactor that changes according to the renderer that the cursor enters but I have not been able to figure how to do it.

---

<div class="post-metadata">

### Author: ![Afonso\_Pinto](https://discourse.vtk.org/user_avatar/discourse.vtk.org/afonso_pinto/32/5191_2.png) [@Afonso\_Pinto](https://discourse.vtk.org/u/Afonso_Pinto)
#### Post date: [July 19, 2022, 10:30am UTC](https://discourse.vtk.org/t/trouble-interacting-with-contextviews-on-viewports/8554/2 "2022-07-19T10:30:16Z")

</div>

I am still stumped on this problem. Does anybody got a solution?
