# Example O3: Highlight a particle

    from ovito.vis import ParticlesVis
    from ovito.qt_compat import QtCore
    from ovito.qt_compat import QtGui

    def render(args):

        # Get output data collection of first scene pipeline.
        data = args.scene.pipelines[0].compute(args.frame)
        positions = data.particles.positions
        pindex = 0 # The index of the particle to be highlighted

        # Project center point of particle.
        xy = args.project_point(positions[pindex])
        if xy is None: return

        # Determine display radius of the particle.
        radius = 0.0
        if 'Radius' in data.particles:
            radius = data.particles['Radius'][pindex]
        if radius <= 0 and data.particles.particle_types is not None:
            particle_type = data.particles.particle_types[pindex]
            radius = data.particles.particle_types.type_by_id(particle_type).radius
        if radius <= 0:
            radius = data.particles.vis.radius

        # Calculate screen-space size of the particle in pixels.
        screen_radius = args.project_size(positions[pindex], radius)

        # Draw a dashed circle around the particle.
        pen = QtGui.QPen(QtCore.Qt.DashLine)
        pen.setWidth(3)
        pen.setColor(QtGui.QColor(0,0,255))
        args.painter.setPen(pen)
        args.painter.drawEllipse(QtCore.QPointF(xy[0], xy[1]), screen_radius, screen_radius)

        # Draw an arrow pointing at the particle.
        arrow_shape = QtGui.QPolygonF()
        arrow_shape.append(QtCore.QPointF(0,0))
        arrow_shape.append(QtCore.QPointF(10,10))
        arrow_shape.append(QtCore.QPointF(10,5))
        arrow_shape.append(QtCore.QPointF(40,5))
        arrow_shape.append(QtCore.QPointF(40,-5))
        arrow_shape.append(QtCore.QPointF(10,-5))
        arrow_shape.append(QtCore.QPointF(10,-10))
        args.painter.setPen(QtGui.QPen())
        args.painter.setBrush(QtGui.QBrush(QtGui.QColor(255,0,0)))
        args.painter.translate(QtCore.QPointF(xy[0], xy[1]))
        args.painter.rotate(-45.0)
        args.painter.translate(QtCore.QPointF(screen_radius,0))
        args.painter.scale(2,2)
        args.painter.drawPolygon(arrow_shape)