Skip to main content

XWindowSystem_Screenshoter

A simple use and little size python library to get screenshot of a single window on linux!

How use

There are two ways to use it, in synchronous and asynchronous mode (in reference to the screenshot) But the statement is very similar.

Declaration

sync

window_sync = WindowCaptureSync("firefox")

async

window_async = WindowCaptureAsync("firefox")

The biggest difference is that in synchronous mode you must call a function to take the screenshot, whereas in asynchronous mode, a capture function is run in a loop and you will only need to call a property that will contain the most recently captured screenshot

To get Screenshot

sync

window_sync = WindowCaptureSync("firefox")
screenshot = window_sync.get_screenshot()

async

window_async = WindowCaptureAsync("firefox")
window_async.start() # Start thread to screenshot loop
...
screenshot = window_async.screenshot
...
window_async.stop() # Stop thread when not used anymore

Examples

sync

import cv2 as cv
from XWindowSystem_Screenshoter import WindowCaptureSync

wincap = WindowCaptureSync("firefox")

# first capture 
image = wincap.get_screenshot()
image = cv.resize(image, (0,0), fx=0.6, fy=0.6)
cv.imshow("Test", image)

while True:
    # press c to update image    
    if cv.waitKey(1) == ord('c'):
        image = wincap.get_screenshot()
        image = cv.resize(image, (0,0), fx=0.6, fy=0.6)
        cv.imshow("Test", image)

    
    if cv.waitKey(1) == ord('q'):
        cv.destroyAllWindows()
        break

async

import cv2 as cv
from XWindowSystem_Screenshoter import WindowCaptureAsync

wincap = WindowCaptureAsync("firefox")
wincap.start()

while True:
    if wincap.screenshot is not None:
        image = wincap.screenshot
        image = cv.resize(image, (0,0), fx=0.6, fy=0.6)

        cv.imshow("Test", image)
        
        if cv.waitKey(1) == ord('q'):
            cv.destroyAllWindows()
            break
wincap.stop() # don't forget to stop thread!
exit(0)

Release files for XWindowSystem-Screenshoter 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for XWindowSystem-Screenshoter 0.0.7
File Size Uploaded
xwindowsystem_screenshoter-0.0.7.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for XWindowSystem-Screenshoter 0.0.7
File Interpreter ABI Platform
xwindowsystem_screenshoter-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / xwindowsystem_screenshoter-0.0.7.tar.gz

Download URL xwindowsystem_screenshoter-0.0.7.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ea7d231d421eeb44d38b38827efa24789e9aa607e367219a25b7d1c7bdc28972
BLAKE2b-256 checksum
How to use checksums
42d7d03fde3eec669b04c3aa656dca4a3de3a6c668c8319704acda32d7a49f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / xwindowsystem_screenshoter-0.0.7-py3-none-any.whl

Download URL xwindowsystem_screenshoter-0.0.7-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a931de6c9ef2f381602060060f1f872a6ce7994fbebc8da2c06e24833c3be9f2
BLAKE2b-256 checksum
How to use checksums
7146b17c363257a1739023ab1c7fb2a13fa3d807b10ccd2aea85f9deea82d3b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page