Fellows, I need some help here. Im trying to do a code that read the time between lefts clicks while right buttom is pressed. If the clicking is slow it will do thing1. If meduim velocity thing 2 and if the clicking is fast will do thing 3.
Would be great if the time count was 100% accurate
What I have done so far:
appreciate any help
Would be great if the time count was 100% accurate
What I have done so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import win32api import time def lmb_down(): # Returns true if the left mouse button is pressed lmb_state = win32api.GetKeyState( 0x01 ) return lmb_state < 0 def rmb_down(): # Returns true if the right mouse button is pressed rmb_state = win32api.GetKeyState( 0x02 ) return rmb_state < 0 def main_function(): start = time.time() while rmb_down(): while lmb_down(): end = time.time() elapsed = end - start if elapsed > 0.4 : print (elapsed, 'slow click' ) elif elapsed > = 0.00000000001 < = 0.4 : print (elapsed, 'medium click' ) elif elapsed < 0.00000000001 : print (elapsed, 'fast clicking' ) while True : main_function() |