I'm looking to create something that interacts with your desktop in some way with pygame.
What I want to do is draw something outside of the pygame window, as in anywhere on the screen.
Is this possible at all?
What would be more helpful, if you can do it at all, is if you can draw without a window even on the screen.
Asked
Active
Viewed 80 times
0

Connor Club
- 64
- 1
- 7
1 Answers
1
I had an idea that to create a transparent fullscreen window That Can Be Displayed on The Desktop.
import pygame
from win32api import GetSystemMetrics
import win32api
import win32con
import win32gui
pygame.init()
screen = pygame.display.set_mode((GetSystemMetrics(0),GetSystemMetrics(1)),pygame.FULLSCREEN)
done = False
fuchsia = (255, 0, 128)
hwnd = pygame.display.get_wm_info()["window"]
win32gui.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE) | win32con.WS_EX_LAYERED)
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)
pygame.draw.rect(screen, (200,200,0), pygame.Rect(30, 30, 100, 100))
pygame.display.update()

RED STONE - GAMEING
- 21
- 2
-
*"I had an idea ..."* - No. You just copied a code snippet from another answer to another question. – Rabbid76 Nov 25 '22 at 05:21
-
from what snippet this is easy for me – RED STONE - GAMEING Jan 24 '23 at 18:10
-
copy/paste from https://stackoverflow.com/questions/550001/fully-transparent-windows-in-pygame/51845075#51845075 (The name `fuchsia` is very treacherous) – Rabbid76 Jan 24 '23 at 18:12
-
I know the idea so I am "copying and Pasting" the idea to Help faster .not to Comment .stop being you have a comment. your comment will do nothing – RED STONE - GAMEING Jan 24 '23 at 18:50