Posted By

Affix on 02/10/11


Tagged

mouse


Versions (?)

Python Mouse Away


 / Published in: Python
 

URL: http://affix.me

  1. from time import time
  2. import pymouse
  3.  
  4. lastTime = time()
  5. mouse = pymouse.PyMouse()
  6. position = mouse.position()
  7. away = 0
  8.  
  9.  
  10. while(1):
  11. if time() >= (lastTime + 60):
  12. if mouse.position() == position:
  13. position = mouse.position()
  14. lastTime = time()
  15. away = 1
  16. else:
  17. away = 0
  18. position = mouse.position()
  19. else:
  20. if away == 1:
  21. if mouse.position() != position:
  22. away = 0
  23. position = mouse.position()

Report this snippet  

You need to login to post a comment.