Pick and highlight glyphs.

I would like to reply an answer myself, for possible future readers.

I succeeded in picking and highlighting specific glyphs.

It still very basic, and needs refinement, but assuming the glyphs are colored by a scalar, from an array called ‘col’

class InteractorStyle(vtk.vtkInteractorStyleTrackballCamera):
    def __init__(self, glyphs, renderer):
        self.glyphs = glyphs
        self.renderer = renderer
        self.AddObserver("LeftButtonPressEvent", self._left_button_press_event)
        self._new_glyph_index = None
        self._old_glyph_index = None
        self._new_glyph_value = None    
        self._old_glyph_value = None

    def _left_button_press_event(self, obj, event):
        click_pos = self.GetInteractor().GetEventPosition()

        cell_picker = vtk.vtkCellPicker()
        cell_picker.Pick(click_pos[0], click_pos[1], 0, self.GetDefaultRenderer())
        if self._new_glyph_value:
            if self._old_glyph_value:
                self.data.GetPointData().GetArray('col').SetValue(self._old_glyph_index, self._old_glyph_value)
        self._new_glyph_index = self.glyph_data.GetOutput().GetPointData().GetArray("InputPointIds").GetValue(cell_picker.GetPointId())
        self._new_glyph_value = self.data.GetPointData().GetArray('col').GetTuple1(self._new_glyph_index)
        self.data.GetPointData().GetArray('col').SetValue(self._new_glyph_index, **number**) 
        self._old_glyph_index = self._new_glyph_index
        self._old_glyph_value = self._new_glyph_value

        self.data.Modified()

This interactor style did what I needed, The number needs to be replaced by a scalar value providing the desired color.

2 Likes