#!/usr/bin/python3

import pyatspi

def caretMoved(e):
    print("caret at position ", e.detail1)

def textChanged(e):
    print("text changed: ", e.detail1, e.detail2)

pyatspi.Registry.registerEventListener(caretMoved, "object:text-caret-moved")
pyatspi.Registry.registerEventListener(textChanged, "object:text-changed")
pyatspi.Registry.start()

