-
Notifications
You must be signed in to change notification settings - Fork 1
/
GTA_2.py
56 lines (48 loc) · 1022 Bytes
/
GTA_2.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import numpy as np
from PIL import ImageGrab
import cv2
import time
from time import sleep
from key import *
def key_press():
for i in list(range(5))[::-1]:
print(i+1)
time.sleep(2)
# f = 'CVWKXAM'
# for i in range(len(f)):
# PressKey(f[i])
# sleep(1)
# ReleaseKey(f[i])
PressKey(L)
sleep(1)
ReleaseKey(L)
PressKey(X)
sleep(1)
ReleaseKey(X)
PressKey(G)
sleep(1)
ReleaseKey(G)
PressKey(I)
sleep(1)
ReleaseKey(I)
PressKey(W)
sleep(1)
ReleaseKey(W)
PressKey(Y)
sleep(1)
ReleaseKey(Y)
PressKey(L)
sleep(1)
ReleaseKey(L)
def screen_record():
last_time = time.time()
while(True):
printscreen = np.array(ImageGrab.grab(bbox=(0,40,640,480)))
Edge = proc_img(printscreen)
print('loop took {} seconds'.format(time.time()-last_time))
last_time = time.time()
cv2.imshow('window',cv2.cvtColor(printscreen, cv2.COLOR_BGR2RGB))
if cv2.waitKey(25) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
key_press()