Created
August 9, 2012 09:42
-
-
Save anonymous/3302727 to your computer and use it in GitHub Desktop.
Slalom canoe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import win32api, win32con | |
VK_CODE = {'left_arrow':0x25, | |
'spacebar':0x20, | |
'right_arrow':0x27} | |
def press(x): | |
win32api.keybd_event(VK_CODE[x], 0,0,0) | |
win32api.keybd_event(VK_CODE[x],0 ,win32con.KEYEVENTF_KEYUP ,0) | |
def go(t): | |
s = time.time() | |
while time.time() - s < t: | |
press("left_arrow") | |
press("right_arrow") | |
def play(): | |
time.sleep(2) | |
go(15) | |
play() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment