-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (23 loc) · 887 Bytes
/
test.py
File metadata and controls
27 lines (23 loc) · 887 Bytes
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
import pygame
import win32api
import win32con
import win32gui
pygame.init()
screen = pygame.display.set_mode((800, 600), pygame.NOFRAME)
done = False
fuchsia = (255, 0, 128) # Transparency color
dark_red = (139, 0, 0)
# Create layered window
hwnd = pygame.display.get_wm_info()["window"]
win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,
win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE) | win32con.WS_EX_LAYERED)
# Set window transparency color
win32gui.SetLayeredWindowAttributes(hwnd, win32api.RGB(*fuchsia), 0, win32con.LWA_COLORKEY)
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill(fuchsia) # Transparent background
pygame.draw.rect(screen, dark_red, pygame.Rect(30, 30, 60, 60),1)
pygame.draw.circle(screen,dark_red,(100,100),100,0)
pygame.display.update()