-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_screenshots.py
More file actions
70 lines (47 loc) · 1.5 KB
/
make_screenshots.py
File metadata and controls
70 lines (47 loc) · 1.5 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import ctypes
from datetime import datetime
import time
import cv2 # instal as opencv-python
import numpy as np
import pyautogui.screenshotUtil
from pynput.keyboard import Key, Listener
#dt = datetime.microsecond # Get timezone naive now
def run_script():
looperCPU = 20
start = time.time()
while (looperCPU != 0):
time.sleep(1)
makeScreen()
looperCPU -= 1
def makeScreen():
#seconds = dt.timestamp()
seconds = time.time()
print(seconds)
image = pyautogui.screenshot()
image2 = cv2.cvtColor(np.array(image), cv2.COLOR_BGR2GRAY)
# print( cv2.imwrite.__doc__)
cv2.imwrite("Medkit_Other/"+seconds.__str__() + ".png", image2)
def run():
ctypes.windll.user32.MessageBoxW(0, "SCP IMAGE is now active", "Start", 0x1000)
print("Start")
def on_release(key):
if key == Key.alt_r:
run_script()
print("End")
if key == Key.scroll_lock:
ctypes.windll.user32.MessageBoxW(0, "Script stopped", "Exiting", 0x1000)
listener.stop()
with Listener(
on_press=None,
on_release=on_release) as listener:
listener.join()
run()
"""while (looperCPU != 0):
start_time = time.time()
# Do some stuff
while printerLooper == True :
print("Sleeping for ", secondsPause, " seconds")
print(random_number)
printerLooper = False
end_time = time.time()
print("total time taken this loop: ", end_time - start_time)"""