Screenshot with ctypes
Tested against Windows 10 / Python 3.11 / Anaconda
pip install screenshotct
import cv2
from screenshotct import take_screenshot
import time
from ctypes_window_info import get_window_infos
for q in get_window_infos():
print(q)
# hwnd
ir = take_screenshot(
hwnd=2100816,
crop=(0, 0, 0, 100),
show_fps=True,
brg_to_rgb=False,
ignore_exceptions=True,
client=True,
)
# first screen
# ir = take_screenshot(
# hwnd='0',
# crop=(0, 0, 0, 100),
# show_fps=True,
# brg_to_rgb=False,
# ignore_exceptions=True,
# client=True,
# )
# all screens
# ir = take_screenshot(
# hwnd="all",
# crop=(0, 0, 0, 100),
# show_fps=True,
# brg_to_rgb=False,
# ignore_exceptions=True,
# client=True,
# )
fps = 0
last_time = time.time()
for _ in range(1000):
try:
pic = next(ir)
fps += 1
cv2.imshow("pic", pic[0])
if cv2.waitKey(1) & 0xFF == ord("q"):
break
except Exception as e:
print(e)
print(f"\n\n\n{fps / (time.time() - last_time)}\n")
cv2.destroyAllWindows()
Release files for screenshotct 0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| screenshotct-0.11.tar.gz | 22.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| screenshotct-0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.0 kB
Release files / screenshotct-0.11.tar.gz
| Download URL | screenshotct-0.11.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
942587d2ed09446f13f9f2dd852c779b66e3905be78543f35c9b4ab2bd6ebb36
|
|
BLAKE2b-256 checksum How to use checksums |
b2ca3dd21f18267a1c308c7f6b811768a38565255b54704fecb52f37615d17e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / screenshotct-0.11-py3-none-any.whl
| Download URL | screenshotct-0.11-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
165eda5e84a3874dba9bc4effffbc4dff3ee80ae986f6b8d3b699132c08f0eff
|
|
BLAKE2b-256 checksum How to use checksums |
119c96d7abd098d14426cc66e47c679594a10fcba10f62e6ee1aedd5fc0e3321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|