Advertisement
Guest User

Untitled

a guest
Aug 7th, 2012
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import time
  2. import pyatspi
  3.  
  4. VK_CODE = {'left_arrow':113,
  5.            'right_arrow':114,
  6.            'spacebar':65 }
  7.  
  8. def press(x):
  9.     pyatspi.Registry.generateKeyboardEvent(VK_CODE[x], None,
  10.                                           pyatspi.KEY_PRESSRELEASE)
  11.  
  12. def play():
  13.         time.sleep(1)
  14.         s = time.time()
  15.         while time.time() - s < 15:
  16.                 press("left_arrow")
  17.                 press("right_arrow")
  18.                 press("left_arrow")
  19.                 press("right_arrow")
  20. # faster without this
  21. #               press('spacebar')  
  22.  
  23. play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement