Skip to content

Commit 03c7db3

Browse files
committed
Additions and updates
1 parent 073e8a0 commit 03c7db3

30 files changed

+415
-84
lines changed

GDI effects/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test.py

GDI effects/BwHell/BwHell.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import win32gui
2+
import win32con
3+
import ctypes
4+
import math
5+
import random
6+
7+
user32 = ctypes.windll.user32
8+
user32.SetProcessDPIAware()
9+
[sw, sh] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
10+
hdc = win32gui.GetDC(0)
11+
12+
while True:
13+
14+
win32gui.BitBlt(
15+
hdc,
16+
0,
17+
0,
18+
sw,
19+
sh,
20+
hdc,
21+
random.randrange(-3, 4),
22+
random.randrange(-3, 4),
23+
win32con.NOTSRCCOPY,
24+
)

GDI effects/Errors/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

GDI effects/Errors/RandomErrors.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import win32gui
2+
import win32con
3+
import ctypes
4+
import random
5+
6+
hdc = win32gui.GetDC(0)
7+
user32 = ctypes.windll.user32
8+
user32.SetProcessDPIAware()
9+
[w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
10+
11+
12+
while True:
13+
win32gui.DrawIcon(
14+
hdc,
15+
random.randint(0, w),
16+
random.randint(0, h),
17+
win32gui.LoadIcon(None, win32con.IDI_ERROR),
18+
) # Change IDI_ERROR to something else to change the icon being displayed

GDI effects/Errors/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

GDI effects/Invert/Invert.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import win32gui
22
import ctypes
3+
import time
4+
35
hdc = win32gui.GetDC(0)
46
user32 = ctypes.windll.user32
57
user32.SetProcessDPIAware()
6-
[w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
8+
[w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
79
while True:
8-
win32gui.InvertRect(hdc, (0, 0, w ,h))
10+
win32gui.InvertRect(hdc, (0, 0, w, h))
11+
time.sleep(0.2) # Adjust delay to your liking

GDI effects/Invert/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

GDI effects/Invert/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

GDI effects/Melt/Melt.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import win32gui
2+
import win32con
3+
import ctypes
4+
import random
5+
import time
6+
7+
8+
hdc = win32gui.GetDC(0)
9+
user32 = ctypes.windll.user32
10+
user32.SetProcessDPIAware()
11+
[w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
12+
13+
14+
x = y = 0
15+
while True:
16+
hdc = win32gui.GetDC(0)
17+
x = random.randint(0, w)
18+
win32gui.BitBlt(hdc, x, 1, 10, h, hdc, x, 0, win32con.SRCCOPY)
19+
win32gui.ReleaseDC(0, hdc)

GDI effects/PanScreen/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

GDI effects/PanScreen/requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

GDI effects/Rainbow hell/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

GDI effects/Rainbow hell/Rainbow hell.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

GDI effects/Rainbow hell/requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import win32gui
2+
import win32api
3+
import win32con
4+
import random
5+
import ctypes
6+
import colorsys
7+
8+
user32 = ctypes.windll.user32
9+
user32.SetProcessDPIAware()
10+
[sw, sh] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
11+
12+
color = 0
13+
while True:
14+
hdc = win32gui.GetDC(0)
15+
16+
rgb_color = colorsys.hsv_to_rgb(color, 1.0, 1.0)
17+
18+
brush = win32gui.CreateSolidBrush(
19+
win32api.RGB(
20+
int(rgb_color[0]) * 255, int(rgb_color[1]) * 255, int(rgb_color[2]) * 255
21+
)
22+
)
23+
win32gui.SelectObject(hdc, brush)
24+
win32gui.BitBlt(
25+
hdc,
26+
random.randint(-10, 10),
27+
random.randint(-10, 10),
28+
sw,
29+
sh,
30+
hdc,
31+
0,
32+
0,
33+
win32con.SRCCOPY,
34+
)
35+
win32gui.BitBlt(
36+
hdc,
37+
random.randint(-10, 10),
38+
random.randint(-10, 10),
39+
sw,
40+
sh,
41+
hdc,
42+
0,
43+
0,
44+
win32con.PATINVERT,
45+
)
46+
color += 0.05
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import win32gui
2+
import win32con
3+
import win32api
4+
import ctypes
5+
import random
6+
import colorsys
7+
8+
hdc = win32gui.GetDC(0)
9+
user32 = ctypes.windll.user32
10+
user32.SetProcessDPIAware()
11+
[w, h] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
12+
color = 0
13+
14+
x = y = 0
15+
while True:
16+
hdc = win32gui.GetDC(0)
17+
18+
# Increment and wrap the hue value adjust as needed (default is 0.02)
19+
color = (color + 0.02) % 1.0
20+
21+
rgb_color = colorsys.hsv_to_rgb(color, 1.0, 1.0)
22+
p = [(random.randint(0, w), random.randint(0, h)) for _ in range(4)]
23+
24+
hPen = win32gui.CreatePen(
25+
win32con.PS_SOLID,
26+
5,
27+
win32api.RGB(
28+
int(rgb_color[0] * 255), int(rgb_color[1] * 255), int(rgb_color[2] * 255)
29+
),
30+
)
31+
32+
win32gui.SelectObject(hdc, hPen)
33+
win32gui.PolyBezier(hdc, p)
34+
win32gui.DeleteObject(hPen)
35+
win32gui.ReleaseDC(0, hdc)

GDI effects/RotatingTunnel/RotTun.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import win32gui
2+
from win32gui import *
3+
import ctypes
4+
5+
user32 = ctypes.windll.user32
6+
user32.SetProcessDPIAware()
7+
[sw, sh] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
8+
9+
screen_size = win32gui.GetWindowRect(win32gui.GetDesktopWindow())
10+
11+
left = screen_size[0]
12+
top = screen_size[1]
13+
right = screen_size[2]
14+
bottom = screen_size[3]
15+
16+
17+
lpppoint = ((left + 50, top - 50), (right + 50, top + 50), (left - 50, bottom - 50))
18+
19+
20+
while True:
21+
22+
hdc = win32gui.GetDC(0)
23+
mhdc = CreateCompatibleDC(hdc)
24+
hbit = CreateCompatibleBitmap(hdc, sh, sw)
25+
holdbit = SelectObject(mhdc, hbit)
26+
27+
PlgBlt(
28+
hdc,
29+
lpppoint,
30+
hdc,
31+
left - 20,
32+
top - 20,
33+
(right - left) + 40,
34+
(bottom - top) + 40,
35+
None,
36+
0,
37+
0,
38+
)
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
21
import win32gui
32
import win32con
43
import ctypes
5-
import math
64

5+
6+
hdc = win32gui.GetDC(0)
77
user32 = ctypes.windll.user32
88
user32.SetProcessDPIAware()
9-
[sw, sh] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
10-
hdc = win32gui.GetDC(0)
9+
[sw, sh] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
1110

1211
while True:
13-
14-
win32gui.BitBlt(hdc, 0, 0, sw, sh, hdc, -3,-3, win32con.NOTSRCCOPY)
15-
12+
hdc = win32gui.GetDC(0)
13+
win32gui.StretchBlt(hdc, -20, 0, sw + 40, sh, hdc, 0, 0, sw, sh, win32con.SRCCOPY)
14+
win32gui.ReleaseDC(0, hdc)

GDI effects/Stretch/StretchVert.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import win32gui
2+
import win32con
3+
import ctypes
4+
5+
6+
hdc = win32gui.GetDC(0)
7+
user32 = ctypes.windll.user32
8+
user32.SetProcessDPIAware()
9+
[sw, sh] = [user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)]
10+
11+
while True:
12+
hdc = win32gui.GetDC(0)
13+
win32gui.StretchBlt(hdc, 0, -20, sw, sh + 40, hdc, 0, 0, sw, sh, win32con.SRCCOPY)
14+
win32gui.ReleaseDC(0, hdc)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# a 1
2+
3+
import win32api
4+
import win32con
5+
import win32gui
6+
import math
7+
import time
8+
import ctypes
9+
10+
11+
def sines():
12+
user32 = ctypes.windll.user32
13+
user32.SetProcessDPIAware()
14+
desktop = win32gui.GetDesktopWindow()
15+
hdc = win32gui.GetWindowDC(desktop)
16+
sw = win32api.GetSystemMetrics(0)
17+
sh = win32api.GetSystemMetrics(1)
18+
angle = 0
19+
20+
while True:
21+
hdc = win32gui.GetWindowDC(desktop)
22+
n = 0
23+
for i in range(int(sw + sh)):
24+
a = int(math.sin(n) * 20)
25+
win32gui.BitBlt(hdc, 0, 0, sw, sh, hdc, a, 0, win32con.SRCCOPY)
26+
n += 0.1
27+
win32gui.ReleaseDC(desktop, hdc)
28+
time.sleep(0.01)
29+
30+
31+
if __name__ == "__main__":
32+
sines()

GDI effects/Triangles/Triangles.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import win32con
2+
import win32gui
3+
import win32ui
4+
import ctypes
5+
import random
6+
7+
8+
def draw_gradient_triangle(hdc):
9+
for _ in range(25):
10+
l, t, r, b = win32gui.GetClientRect(win32gui.GetDesktopWindow())
11+
vertices = (
12+
{
13+
"x": int(random.random() * r),
14+
"y": int(random.random() * b),
15+
"Red": int(random.random() * 0xFF00),
16+
"Green": 0,
17+
"Blue": 0,
18+
"Alpha": 0,
19+
},
20+
{
21+
"x": int(random.random() * r),
22+
"y": int(random.random() * b),
23+
"Red": 0,
24+
"Green": int(random.random() * 0xFF00),
25+
"Blue": 0,
26+
"Alpha": 0,
27+
},
28+
{
29+
"x": int(random.random() * r),
30+
"y": int(random.random() * b),
31+
"Red": 0,
32+
"Green": 0,
33+
"Blue": int(random.random() * 0xFF00),
34+
"Alpha": 0,
35+
},
36+
)
37+
mesh = ((0, 1, 2),)
38+
win32gui.GradientFill(hdc, vertices, mesh, win32con.GRADIENT_FILL_TRIANGLE)
39+
40+
41+
def main():
42+
user32 = ctypes.windll.user32
43+
user32.SetProcessDPIAware()
44+
45+
hdc_screen = win32gui.GetDC(0)
46+
47+
try:
48+
while True:
49+
draw_gradient_triangle(hdc_screen)
50+
finally:
51+
win32gui.ReleaseDC(0, hdc_screen)
52+
53+
54+
if __name__ == "__main__":
55+
main()

0 commit comments

Comments
 (0)