Skip to content
  • As of FSLeyes 0.20.0, it is no longer necessary to create a Profile sub-class in order to be notified of mouse/keyboard events. Instead, you can use the Profile.registerHandler method like so:

    ortho      = frame.viewPanels[0]
    profile    = ortho.getCurrentProfile()
    displayCtx = ortho.displayCtx
    
    def onmouse(ev, canvas, mousePos, canvasPos):
        overlay  = displayCtx.getSelectedOverlay()
        opts     = displayCtx.getOpts(overlay)
        worldLoc = displayCtx.location
        voxelLoc = opts.getVoxel(worldLoc)
        print('Location changed: {}'.format(voxelLoc))
        print(canvasPos)
    
    profile.registerHandler('LeftMouseDown', 'mylistenername', onmouse)
    
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment