[orca-list] Detecting Double Key Press in orca-customizations.py



Hi,
I know double key presses are used in things like the where a I function. I was wondering how to add this in to the customizations.py file too.  I tried writing my own, but although the code works in stand alone form, it doesn't work in the customizations file. Just for reference, here's the code:
import time
class countPresses:
    def __init__(self):
        self.clicks = 0
        self.now = time.time()

    def clickCount(self):
        if time.time() <= self.now + 0.75:
            self.clicks += 1
        self.now = time.time()
        if self.clicks > 2: self.clicks = 1
        return self.clicks

test = countPresses()
print str(test.clickCount())
print str(test.clickCount())
print str(test.clickCount())
time.sleep(3)
print str(test.clickCount())


-- 
Thoughts of a Dragon:
http://www.stormdragon.us/
What color dragon are you?
http://quizfarm.com/quizzes/new/alustriel07/what-color-dragon-would-you-be/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]