Screenshots - ctypes
Project description
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
screenshotct-0.11.tar.gz
(22.3 kB
view details)
Built Distribution
File details
Details for the file screenshotct-0.11.tar.gz
.
File metadata
- Download URL: screenshotct-0.11.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 942587d2ed09446f13f9f2dd852c779b66e3905be78543f35c9b4ab2bd6ebb36 |
|
MD5 | 921983e4c07d4545f782ecbc52b7b2d6 |
|
BLAKE2b-256 | b2ca3dd21f18267a1c308c7f6b811768a38565255b54704fecb52f37615d17e2 |
File details
Details for the file screenshotct-0.11-py3-none-any.whl
.
File metadata
- Download URL: screenshotct-0.11-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 165eda5e84a3874dba9bc4effffbc4dff3ee80ae986f6b8d3b699132c08f0eff |
|
MD5 | 63d45ff220f5c01c0ff495e5c0312b6f |
|
BLAKE2b-256 | 119c96d7abd098d14426cc66e47c679594a10fcba10f62e6ee1aedd5fc0e3321 |