Added at the Top:
Code: Select all
import time
Code: Select all
def __init__(self):
do_load_ops()
# Get the Time
self.lasttime=time.clock()
Code: Select all
def on_caret_move(self, ed_self):
if ed_self.get_carets(): return #donot allow mul-carets
if ed_self.get_text_len() > MAX_SIZE: return
# Compare Current Time with Time from Previous Visit to this Function
# and if that was too recent do NOT HiLite (this will prevent flickering)
difftime=time.clock()-self.lasttime
self.lasttime=time.clock()
if difftime<1:return
Any other programming language on Windows I would have used a Timer that delays the Hilite for x milliseconds. This Timer is restarted everytime on_caret_move fires and thus cancelling the previous Timer.
I'd love to know how to do this in Python but I could not get threading.Timer to work...