Python Mouse Away


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  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()

URL: http://affix.me

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.