-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDot.py
62 lines (49 loc) · 1.74 KB
/
Dot.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
57
58
59
60
61
62
import win32gui, time
import pyautogui
import win32api
import win32con
import sys
def dotrun(x2,y2):
try:
# while True:
x = int(400) # 1920 / 2 = 960 for X position on screen.
y = int(321) # 1200 / 2 = 600 for Y position on screen.
x = x2
y = y2
green = win32api.RGB(0,255,0)
color = int(green) # Pixel color, 255 = Red
hwnd = win32gui.WindowFromPoint((x, y))
hdc = win32gui.GetDC(hwnd)
x1, y1 = win32gui.ScreenToClient(hwnd, (x, y))
win32gui.SetPixel(hdc, x1, y1, color)
win32gui.SetPixel(hdc, x1 - 1, y1, color)
win32gui.SetPixel(hdc, x1 + 1, y1, color)
win32gui.SetPixel(hdc, x1, y1 + 1, color)
win32gui.SetPixel(hdc, x1 - 1, y1 - 1, color)
win32gui.SetPixel(hdc, x1 + 1, y1 + 1, color)
win32gui.SetPixel(hdc, x1 - 1, y1 + 1, color)
win32gui.SetPixel(hdc, x1 + 1, y1 - 1, color)
win32gui.SetPixel(hdc, x1 - 2, y1, color)
win32gui.SetPixel(hdc, x1 + 2, y1, color)
win32gui.SetPixel(hdc, x1, y1 - 2, color)
win32gui.SetPixel(hdc, x1, y1 + 2, color)
win32gui.SetPixel(hdc, x1 - 2, y1 - 2, color)
win32gui.SetPixel(hdc, x1 + 2, y1 + 2, color)
win32gui.SetPixel(hdc, x1 - 2, y1 + 2, color)
win32gui.SetPixel(hdc, x1 + 2, y1 - 2, color)
win32gui.ReleaseDC(hwnd, hdc)
# time.sleep(0.1)
except KeyboardInterrupt:
print('exit')
sys.exit()
def test(x2,y2):
try:
time.sleep(5)
win32api.SetCursorPos((x2, y2))
while True:
print(win32gui.GetCursorInfo())
except KeyboardInterrupt:
print("exit")
sys.exit()
dotrun(383,321)
#test(400,321)