Screenshots - ctypes
Project description
Screenshot with ctypes
Tested against Windows 10 / Python 3.11 / Anaconda
pip install getpublicipv4
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.10.tar.gz
(22.4 kB
view hashes)
Built Distribution
Close
Hashes for screenshotct-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 764250dd8d3a692ad6194dfd41b29a8338ea238914fdc83a4e6375b06081d42e |
|
MD5 | 5ac4195d09b49a9301f6d4f421c482ad |
|
BLAKE2b-256 | c87cad6b4d651062aa3273a3f774d95bfe8f25de06c1631d8e87611cb7a6a104 |