ctypes-screenshots


Namectypes-screenshots JSON
Version 0.12 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/ctypes_screenshots
SummaryTakes screenshots without pywin32 dependency (whole screen/single window)
upload_time2022-12-22 00:50:53
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords screenshots ctypes
VCS
bugtrack_url
requirements mss numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Takes screenshots without pywin32 dependency (whole screen/single window)



```python

pip install ctypes-screenshot

```



```python

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")







```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/ctypes_screenshots",
    "name": "ctypes-screenshots",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "screenshots,ctypes",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/af/5e/1ce45d8e3baf6dfdf497953650eaff793f68d2eca00d5e421cca7aa4ce8c/ctypes_screenshots-0.12.tar.gz",
    "platform": null,
    "description": "\n# Takes screenshots without pywin32 dependency (whole screen/single window)\n\n\n\n```python\n\npip install ctypes-screenshot\n\n```\n\n\n\n```python\n\nfrom ctypes_screenshots import screencapture_window, list_windows, screencapture\n\n\n\nimport cv2\n\nimport time\n\n\n\n# get the hwnd if you want to capture a single window\n\nlist_windows()\n\n# Out[5]: \n\n# [WindowInfo(pid=1544, title='Seagate Expansion Drive (F:)', hwnd=525322, length=29),\n\n#  WindowInfo(pid=1840, title='', hwnd=72700, length=1),\n\n#  WindowInfo(pid=1840, title='', hwnd=72702, length=1),\n\n#  WindowInfo(pid=1840, title='jFDSk.png @ 100% (Layer 1, RGB/8)', hwnd=2362732, length=34),\n\n#  WindowInfo(pid=3416, title='', hwnd=131744, length=1),\n\n\n\n# captures a single window\n\nfor _ in screencapture_window(hwnd=5901160):\n\n    last_time = time.time()\n\n    cv2.imshow(\"OpenCV/Numpy normal\", _)\n\n    if cv2.waitKey(25) & 0xFF == ord(\"q\"):\n\n        cv2.destroyAllWindows()\n\n        break\n\n    print(f\"fps: {1 / (time.time() - last_time)}\", end=\"\\r\")\n\n\n\n# uses mss \n\nfor _ in screencapture(monitor={\"top\": 40, \"left\": 0, \"width\": 800, \"height\": 640}):\n\n    last_time = time.time()\n\n    cv2.imshow(\"OpenCV/Numpy normal\", _)\n\n    if cv2.waitKey(25) & 0xFF == ord(\"q\"):\n\n        cv2.destroyAllWindows()\n\n        break\n\n    print(f\"fps: {1 / (time.time() - last_time)}\", end=\"\\r\")\n\n\n\n\n\n\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Takes screenshots without pywin32 dependency (whole screen/single window)",
    "version": "0.12",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/ctypes_screenshots"
    },
    "split_keywords": [
        "screenshots",
        "ctypes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cce2010205bc25996d9913f8423e0fe852f7cb4fed5970cb093397af0e58e1f9",
                "md5": "dbed88558a6e0a2eee385568273209d5",
                "sha256": "aad6532d2563f005cf693b23f5802dd8b6a1458937a8300cf61574f73162691e"
            },
            "downloads": -1,
            "filename": "ctypes_screenshots-0.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dbed88558a6e0a2eee385568273209d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7246,
            "upload_time": "2022-12-22T00:50:52",
            "upload_time_iso_8601": "2022-12-22T00:50:52.776592Z",
            "url": "https://files.pythonhosted.org/packages/cc/e2/010205bc25996d9913f8423e0fe852f7cb4fed5970cb093397af0e58e1f9/ctypes_screenshots-0.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af5e1ce45d8e3baf6dfdf497953650eaff793f68d2eca00d5e421cca7aa4ce8c",
                "md5": "cb62ac2ce20534b9a401e4b2c634e7cf",
                "sha256": "91964693fb1264fc58d2b2acd601eabc5525e32bc61a67325fafb3e694476889"
            },
            "downloads": -1,
            "filename": "ctypes_screenshots-0.12.tar.gz",
            "has_sig": false,
            "md5_digest": "cb62ac2ce20534b9a401e4b2c634e7cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5686,
            "upload_time": "2022-12-22T00:50:53",
            "upload_time_iso_8601": "2022-12-22T00:50:53.939753Z",
            "url": "https://files.pythonhosted.org/packages/af/5e/1ce45d8e3baf6dfdf497953650eaff793f68d2eca00d5e421cca7aa4ce8c/ctypes_screenshots-0.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-22 00:50:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "ctypes_screenshots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "mss",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        }
    ],
    "lcname": "ctypes-screenshots"
}
        
Elapsed time: 0.50034s