screenshotct


Namescreenshotct JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/screenshotct
SummaryScreenshots - ctypes
upload_time2024-04-04 02:06:24
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords screenshots
VCS
bugtrack_url
requirements getmonitorresolution numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Screenshot with ctypes

## Tested against Windows 10 / Python 3.11 / Anaconda

### pip install screenshotct

```PY
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()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/screenshotct",
    "name": "screenshotct",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "screenshots",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/ca/3dd21f18267a1c308c7f6b811768a38565255b54704fecb52f37615d17e2/screenshotct-0.11.tar.gz",
    "platform": null,
    "description": "\r\n# Screenshot with ctypes\r\n\r\n## Tested against Windows 10 / Python 3.11 / Anaconda\r\n\r\n### pip install screenshotct\r\n\r\n```PY\r\nimport cv2\r\nfrom screenshotct import take_screenshot\r\nimport time\r\nfrom ctypes_window_info import get_window_infos\r\n\r\nfor q in get_window_infos():\r\n    print(q)\r\n\r\n# hwnd\r\nir = take_screenshot(\r\n    hwnd=2100816,\r\n    crop=(0, 0, 0, 100),\r\n    show_fps=True,\r\n    brg_to_rgb=False,\r\n    ignore_exceptions=True,\r\n    client=True,\r\n)\r\n\r\n# first screen\r\n# ir = take_screenshot(\r\n#     hwnd='0',\r\n#     crop=(0, 0, 0, 100),\r\n#     show_fps=True,\r\n#     brg_to_rgb=False,\r\n#     ignore_exceptions=True,\r\n#     client=True,\r\n# )\r\n\r\n# all screens\r\n# ir = take_screenshot(\r\n#     hwnd=\"all\",\r\n#     crop=(0, 0, 0, 100),\r\n#     show_fps=True,\r\n#     brg_to_rgb=False,\r\n#     ignore_exceptions=True,\r\n#     client=True,\r\n# )\r\n\r\nfps = 0\r\nlast_time = time.time()\r\nfor _ in range(1000):\r\n    try:\r\n        pic = next(ir)\r\n        fps += 1\r\n        cv2.imshow(\"pic\", pic[0])\r\n        if cv2.waitKey(1) & 0xFF == ord(\"q\"):\r\n            break\r\n    except Exception as e:\r\n        print(e)\r\nprint(f\"\\n\\n\\n{fps / (time.time() - last_time)}\\n\")\r\ncv2.destroyAllWindows()\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Screenshots - ctypes",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/screenshotct"
    },
    "split_keywords": [
        "screenshots"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "119c96d7abd098d14426cc66e47c679594a10fcba10f62e6ee1aedd5fc0e3321",
                "md5": "63d45ff220f5c01c0ff495e5c0312b6f",
                "sha256": "165eda5e84a3874dba9bc4effffbc4dff3ee80ae986f6b8d3b699132c08f0eff"
            },
            "downloads": -1,
            "filename": "screenshotct-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "63d45ff220f5c01c0ff495e5c0312b6f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 22714,
            "upload_time": "2024-04-04T02:06:22",
            "upload_time_iso_8601": "2024-04-04T02:06:22.635908Z",
            "url": "https://files.pythonhosted.org/packages/11/9c/96d7abd098d14426cc66e47c679594a10fcba10f62e6ee1aedd5fc0e3321/screenshotct-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2ca3dd21f18267a1c308c7f6b811768a38565255b54704fecb52f37615d17e2",
                "md5": "921983e4c07d4545f782ecbc52b7b2d6",
                "sha256": "942587d2ed09446f13f9f2dd852c779b66e3905be78543f35c9b4ab2bd6ebb36"
            },
            "downloads": -1,
            "filename": "screenshotct-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "921983e4c07d4545f782ecbc52b7b2d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22334,
            "upload_time": "2024-04-04T02:06:24",
            "upload_time_iso_8601": "2024-04-04T02:06:24.280029Z",
            "url": "https://files.pythonhosted.org/packages/b2/ca/3dd21f18267a1c308c7f6b811768a38565255b54704fecb52f37615d17e2/screenshotct-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 02:06:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "screenshotct",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "getmonitorresolution",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        }
    ],
    "lcname": "screenshotct"
}
        
Elapsed time: 0.25719s