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):
I am using python-VTK and I am displaying the renderwindow in a PyQt widget. My code is as follows:
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[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.