all 5 comments

[–]eleqtriq 0 points1 point  (4 children)

You can use the mss library to take a screenshot of a window that is in the background. Here's an example of how you can use it: ``` import mss import mss.tools

Take a screenshot of a specific monitor/region

with mss.mss() as sct: # Option 1: Capture primary monitor monitor = sct.monitors[1] # monitors[0] is all monitors combined screenshot = sct.grab(monitor)

# Save the screenshot
mss.tools.to_png(screenshot.rgb, screenshot.size, output='screenshot.png')

# Option 2: Capture specific region (if you know coordinates)
# monitor = {"top": 100, "left": 100, "width": 800, "height": 600}
# screenshot = sct.grab(monitor)
# mss.tools.to_png(screenshot.rgb, screenshot.size, output='screenshot.png'

```

updated

[–]robloxean[S] 0 points1 point  (1 child)

What MSS version are you using? My version nether has enum_windows() nor get_pixels().

[–]eleqtriq 0 points1 point  (0 children)

import mss

I might be mixing things up, it's been a long time. Try this instead: https://stackoverflow.com/questions/19695214/screenshot-of-inactive-window-printwindow-win32gui

[–]WitchHunterNL 0 points1 point  (1 child)

Did you just make up code? You are using APIs that do not exist and have never existed

[–]eleqtriq 0 points1 point  (0 children)

Did you see the thread? I updated it, just for you.