Takes screenshots without pywin32 dependency (whole screen/single window)
pip install ctypes-screenshot
from ctypes_screenshots import screencapture_window, list_windows, screencapture
import cv2
import time
# get the hwnd if you want to capture a single window
list_windows()
# Out[5]:
# [WindowInfo(pid=1544, title='Seagate Expansion Drive (F:)', hwnd=525322, length=29),
# WindowInfo(pid=1840, title='', hwnd=72700, length=1),
# WindowInfo(pid=1840, title='', hwnd=72702, length=1),
# WindowInfo(pid=1840, title='jFDSk.png @ 100% (Layer 1, RGB/8)', hwnd=2362732, length=34),
# WindowInfo(pid=3416, title='', hwnd=131744, length=1),
# captures a single window
for _ in screencapture_window(hwnd=5901160):
last_time = time.time()
cv2.imshow("OpenCV/Numpy normal", _)
if cv2.waitKey(25) & 0xFF == ord("q"):
cv2.destroyAllWindows()
break
print(f"fps: {1 / (time.time() - last_time)}", end="\r")
# uses mss
for _ in screencapture(monitor={"top": 40, "left": 0, "width": 800, "height": 640}):
last_time = time.time()
cv2.imshow("OpenCV/Numpy normal", _)
if cv2.waitKey(25) & 0xFF == ord("q"):
cv2.destroyAllWindows()
break
print(f"fps: {1 / (time.time() - last_time)}", end="\r")
Metadata
Release files for ctypes-screenshots 0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ctypes_screenshots-0.12.tar.gz | 5.7 kB | Without provenance | Details for ctypes_screenshots-0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ctypes_screenshots-0.12-py3-none-any.whl | Python 3 | none | any | Details for ctypes_screenshots-0.12-py3-none-any.whl |
Total release size: 12.9 kB
Release files / ctypes_screenshots-0.12.tar.gz
| Download URL | ctypes_screenshots-0.12.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91964693fb1264fc58d2b2acd601eabc5525e32bc61a67325fafb3e694476889
|
|
BLAKE2b-256 checksum How to use checksums |
af5e1ce45d8e3baf6dfdf497953650eaff793f68d2eca00d5e421cca7aa4ce8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / ctypes_screenshots-0.12-py3-none-any.whl
| Download URL | ctypes_screenshots-0.12-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aad6532d2563f005cf693b23f5802dd8b6a1458937a8300cf61574f73162691e
|
|
BLAKE2b-256 checksum How to use checksums |
cce2010205bc25996d9913f8423e0fe852f7cb4fed5970cb093397af0e58e1f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for ctypes-screenshots 0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.