consolectrlchandler


Nameconsolectrlchandler JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/consolectrlchandler
SummaryHandler for CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT
upload_time2024-04-03 04:54:42
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords ctrl handler break
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# handler for CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT

## Tested against Windows 10 / Python 3.11 / Anaconda

### pip install consolectrlchandler



```py
    Console Control Handler for Windows

    This module provides functionality for handling console control events in Windows,
    namely CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT

        Args:
            ctrl_type (int): The type of control event.

        Returns:
            bool: True if the event is handled; False otherwise.

        Example:
            To use this module, import it and set your desired function as the console handler:

            >>> from consolectrlhandler import ctrl_config

            Define your custom function to handle console control events:

            >>> def ctrl_handler(ctrl_type):
            ...     print(f"Received control event: {ctrl_type}")

            Assign your custom function as the console handler:

            >>> ctrl_config.function = ctrl_handler

            Then run your main program loop.

            # Complete code
            from consolectrlchandler import ctrl_config
            import time

            def ctrlhandler(ctrl_type):
                print(f"ctrl handler {ctrl_type}")

            ctrl_config.function = ctrlhandler
            while True:
                print("test")
                time.sleep(1)


    test
    test
    ctrl handler 0
    test
    ctrl handler 0
    ctrl handler 0
    ctrl handler 0
    ctrl handler 0
    test
    ctrl handler 0
    test
    test
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/consolectrlchandler",
    "name": "consolectrlchandler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "ctrl, handler, break",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/27/e2/a4b5fa2ae21e823e09fa527ade0c07f8d55d375e1d272fa9eb3a5a1fa866/consolectrlchandler-0.11.tar.gz",
    "platform": null,
    "description": "\r\n# handler for CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT\r\n\r\n## Tested against Windows 10 / Python 3.11 / Anaconda\r\n\r\n### pip install consolectrlchandler\r\n\r\n\r\n\r\n```py\r\n    Console Control Handler for Windows\r\n\r\n    This module provides functionality for handling console control events in Windows,\r\n    namely CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT\r\n\r\n        Args:\r\n            ctrl_type (int): The type of control event.\r\n\r\n        Returns:\r\n            bool: True if the event is handled; False otherwise.\r\n\r\n        Example:\r\n            To use this module, import it and set your desired function as the console handler:\r\n\r\n            >>> from consolectrlhandler import ctrl_config\r\n\r\n            Define your custom function to handle console control events:\r\n\r\n            >>> def ctrl_handler(ctrl_type):\r\n            ...     print(f\"Received control event: {ctrl_type}\")\r\n\r\n            Assign your custom function as the console handler:\r\n\r\n            >>> ctrl_config.function = ctrl_handler\r\n\r\n            Then run your main program loop.\r\n\r\n            # Complete code\r\n            from consolectrlchandler import ctrl_config\r\n            import time\r\n\r\n            def ctrlhandler(ctrl_type):\r\n                print(f\"ctrl handler {ctrl_type}\")\r\n\r\n            ctrl_config.function = ctrlhandler\r\n            while True:\r\n                print(\"test\")\r\n                time.sleep(1)\r\n\r\n\r\n    test\r\n    test\r\n    ctrl handler 0\r\n    test\r\n    ctrl handler 0\r\n    ctrl handler 0\r\n    ctrl handler 0\r\n    ctrl handler 0\r\n    test\r\n    ctrl handler 0\r\n    test\r\n    test\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Handler for CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/consolectrlchandler"
    },
    "split_keywords": [
        "ctrl",
        " handler",
        " break"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f80c2bdf279f7890dfc66360177fdd68f3a7637970211fb8a9b5a5626018cecd",
                "md5": "3f67a9f818583dc0a7fd764a68f88210",
                "sha256": "e905dd9a5bda146d3847b48ffb47e31e58e69d5f2887e8ea0158d2f715fc115b"
            },
            "downloads": -1,
            "filename": "consolectrlchandler-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f67a9f818583dc0a7fd764a68f88210",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4905,
            "upload_time": "2024-04-03T04:54:41",
            "upload_time_iso_8601": "2024-04-03T04:54:41.171376Z",
            "url": "https://files.pythonhosted.org/packages/f8/0c/2bdf279f7890dfc66360177fdd68f3a7637970211fb8a9b5a5626018cecd/consolectrlchandler-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27e2a4b5fa2ae21e823e09fa527ade0c07f8d55d375e1d272fa9eb3a5a1fa866",
                "md5": "e4d453d5d4a9f70c535d672f21bcb5a2",
                "sha256": "92942110a4f70ef64e61aae771bf8fbf4a66a09beb16efd5ba42ca91260eba57"
            },
            "downloads": -1,
            "filename": "consolectrlchandler-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "e4d453d5d4a9f70c535d672f21bcb5a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3574,
            "upload_time": "2024-04-03T04:54:42",
            "upload_time_iso_8601": "2024-04-03T04:54:42.935462Z",
            "url": "https://files.pythonhosted.org/packages/27/e2/a4b5fa2ae21e823e09fa527ade0c07f8d55d375e1d272fa9eb3a5a1fa866/consolectrlchandler-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-03 04:54:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "consolectrlchandler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "consolectrlchandler"
}
        
Elapsed time: 0.23718s