XWindowSystem-Screenshoter


NameXWindowSystem-Screenshoter JSON
Version 0.0.7 PyPI version JSON
download
home_page
SummaryA simple use to capture a screenshot of single window in linux Systems
upload_time2024-01-23 21:40:31
maintainer
docs_urlNone
author
requires_python>=3.6
licenseCopyright 2024 Matheus Verginio Fernandes Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords linux xwindowsystem screenshot single window
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # XWindowSystem_Screenshoter
<h3>A simple use and little size python library to get screenshot of a single window on linux!</h3>

# How use
There are two ways to use it, in synchronous and asynchronous mode (in reference to the screenshot) But the statement is very similar.

## Declaration

### sync
```python
window_sync = WindowCaptureSync("firefox")
```

### async
```
window_async = WindowCaptureAsync("firefox")
```

The biggest difference is that in synchronous mode you must call a function to take the screenshot, whereas in asynchronous mode, a capture function is run in a loop and you will only need to call a property that will contain the most recently captured screenshot

## To get Screenshot

### sync
```python
window_sync = WindowCaptureSync("firefox")
screenshot = window_sync.get_screenshot()
```

### async
```python
window_async = WindowCaptureAsync("firefox")
window_async.start() # Start thread to screenshot loop
...
screenshot = window_async.screenshot
...
window_async.stop() # Stop thread when not used anymore
```

## Examples

### sync
```python
import cv2 as cv
from XWindowSystem_Screenshoter import WindowCaptureSync

wincap = WindowCaptureSync("firefox")

# first capture 
image = wincap.get_screenshot()
image = cv.resize(image, (0,0), fx=0.6, fy=0.6)
cv.imshow("Test", image)

while True:
    # press c to update image    
    if cv.waitKey(1) == ord('c'):
        image = wincap.get_screenshot()
        image = cv.resize(image, (0,0), fx=0.6, fy=0.6)
        cv.imshow("Test", image)

    
    if cv.waitKey(1) == ord('q'):
        cv.destroyAllWindows()
        break

```

### async
```python
import cv2 as cv
from XWindowSystem_Screenshoter import WindowCaptureAsync

wincap = WindowCaptureAsync("firefox")
wincap.start()

while True:
    if wincap.screenshot is not None:
        image = wincap.screenshot
        image = cv.resize(image, (0,0), fx=0.6, fy=0.6)

        cv.imshow("Test", image)
        
        if cv.waitKey(1) == ord('q'):
            cv.destroyAllWindows()
            break
wincap.stop() # don't forget to stop thread!
exit(0)

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "XWindowSystem-Screenshoter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Linux,XWindowSystem,screenshot,single window",
    "author": "",
    "author_email": "Matheus Verginio Fernandes <matheus.fernandes92.235@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/42/d7/d03fde3eec669b04c3aa656dca4a3de3a6c668c8319704acda32d7a49f82/xwindowsystem_screenshoter-0.0.7.tar.gz",
    "platform": null,
    "description": "# XWindowSystem_Screenshoter\n<h3>A simple use and little size python library to get screenshot of a single window on linux!</h3>\n\n# How use\nThere are two ways to use it, in synchronous and asynchronous mode (in reference to the screenshot) But the statement is very similar.\n\n## Declaration\n\n### sync\n```python\nwindow_sync = WindowCaptureSync(\"firefox\")\n```\n\n### async\n```\nwindow_async = WindowCaptureAsync(\"firefox\")\n```\n\nThe biggest difference is that in synchronous mode you must call a function to take the screenshot, whereas in asynchronous mode, a capture function is run in a loop and you will only need to call a property that will contain the most recently captured screenshot\n\n## To get Screenshot\n\n### sync\n```python\nwindow_sync = WindowCaptureSync(\"firefox\")\nscreenshot = window_sync.get_screenshot()\n```\n\n### async\n```python\nwindow_async = WindowCaptureAsync(\"firefox\")\nwindow_async.start() # Start thread to screenshot loop\n...\nscreenshot = window_async.screenshot\n...\nwindow_async.stop() # Stop thread when not used anymore\n```\n\n## Examples\n\n### sync\n```python\nimport cv2 as cv\nfrom XWindowSystem_Screenshoter import WindowCaptureSync\n\nwincap = WindowCaptureSync(\"firefox\")\n\n# first capture \nimage = wincap.get_screenshot()\nimage = cv.resize(image, (0,0), fx=0.6, fy=0.6)\ncv.imshow(\"Test\", image)\n\nwhile True:\n    # press c to update image    \n    if cv.waitKey(1) == ord('c'):\n        image = wincap.get_screenshot()\n        image = cv.resize(image, (0,0), fx=0.6, fy=0.6)\n        cv.imshow(\"Test\", image)\n\n    \n    if cv.waitKey(1) == ord('q'):\n        cv.destroyAllWindows()\n        break\n\n```\n\n### async\n```python\nimport cv2 as cv\nfrom XWindowSystem_Screenshoter import WindowCaptureAsync\n\nwincap = WindowCaptureAsync(\"firefox\")\nwincap.start()\n\nwhile True:\n    if wincap.screenshot is not None:\n        image = wincap.screenshot\n        image = cv.resize(image, (0,0), fx=0.6, fy=0.6)\n\n        cv.imshow(\"Test\", image)\n        \n        if cv.waitKey(1) == ord('q'):\n            cv.destroyAllWindows()\n            break\nwincap.stop() # don't forget to stop thread!\nexit(0)\n\n```\n",
    "bugtrack_url": null,
    "license": "Copyright 2024 Matheus Verginio Fernandes  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A simple use to capture a screenshot of single window in linux Systems",
    "version": "0.0.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/UR4N0-235/XWindowSystem_Screenshoter/issues",
        "Repository": "https://github.com/UR4N0-235/XWindowSystem_Screenshoter"
    },
    "split_keywords": [
        "linux",
        "xwindowsystem",
        "screenshot",
        "single window"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7146b17c363257a1739023ab1c7fb2a13fa3d807b10ccd2aea85f9deea82d3b9",
                "md5": "4cd54eaf6040a7d30b38eaaac4ebfe06",
                "sha256": "a931de6c9ef2f381602060060f1f872a6ce7994fbebc8da2c06e24833c3be9f2"
            },
            "downloads": -1,
            "filename": "xwindowsystem_screenshoter-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4cd54eaf6040a7d30b38eaaac4ebfe06",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5378,
            "upload_time": "2024-01-23T21:40:29",
            "upload_time_iso_8601": "2024-01-23T21:40:29.435115Z",
            "url": "https://files.pythonhosted.org/packages/71/46/b17c363257a1739023ab1c7fb2a13fa3d807b10ccd2aea85f9deea82d3b9/xwindowsystem_screenshoter-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42d7d03fde3eec669b04c3aa656dca4a3de3a6c668c8319704acda32d7a49f82",
                "md5": "ab16403a6c59cd8b18f2f5593ce8330b",
                "sha256": "ea7d231d421eeb44d38b38827efa24789e9aa607e367219a25b7d1c7bdc28972"
            },
            "downloads": -1,
            "filename": "xwindowsystem_screenshoter-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "ab16403a6c59cd8b18f2f5593ce8330b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3086,
            "upload_time": "2024-01-23T21:40:31",
            "upload_time_iso_8601": "2024-01-23T21:40:31.768821Z",
            "url": "https://files.pythonhosted.org/packages/42/d7/d03fde3eec669b04c3aa656dca4a3de3a6c668c8319704acda32d7a49f82/xwindowsystem_screenshoter-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-23 21:40:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "UR4N0-235",
    "github_project": "XWindowSystem_Screenshoter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "xwindowsystem-screenshoter"
}
        
Elapsed time: 2.67160s