-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandpxl.py
37 lines (29 loc) · 840 Bytes
/
randpxl.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
import win32gui
import win32api
import random
import pyautogui
import os
import threading
width, height = pyautogui.size()
dc = win32gui.GetDC(0)
def randpxl(a, b):
#lock.acquire()
#lock.release()
while (1):
colors = win32api.RGB(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
win32gui.SetPixel(dc, a, b, colors)
a = a + random.randint(-1, 1)
b = b + random.randint(-1, 1)
if a < 0:
a = a + width
if a > (width-1):
a = a - width
if b < 0:
b = b + height
if b > (height-1):
b = b - height
if __name__ == "__main__":
thread_lock = threading.Lock()
t1 = threading.Thread(target=randpxl, args=(0, 0))
t1.start()
t1.join()