input-timeout


Nameinput-timeout JSON
Version 0.21 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/input_timeout
SummaryLike python's input(), but with timeout and default value
upload_time2022-10-02 05:31:10
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords timeout input default value
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# input_timeout



Define how long you want to wait for the user's input.

After the time is over, a default value is set. 



### Install it:



```python

pip install input-timeout

```



### Use it:



```python

from input_timeout import InputTimeout



        i = InputTimeout(

            timeout=20,

            input_message=" >> ",

            timeout_message="'Sorry, you were not fast enough'",

            defaultvalue="slow",

            cancelbutton="esc",

            show_special_characters_warning='If you want to use special characters, you have to use alt+\\d\\d\\d\\d\nPress "ctrl" to see a complete list of all combinations!',

        ).finalvalue

        print(f"\n\nYour input was {i}")



        i = InputTimeout(

            timeout=5,

            input_message=" >> ",

            timeout_message="Sorry, you were not fast enough: ",

            defaultvalue="slow",

            cancelbutton="esc",

            show_special_characters_warning='If you want to use special characters, you have to use alt+\\d\\d\\d\\d\nPress "ctrl" to see a complete list of all combinations!',

        ).finalvalue

        print(f"\n\nYour input was {i}")



        i = InputTimeout(

            timeout=10,

            input_message=" >> ",

            timeout_message="Sorry, you were not fast enough",

            defaultvalue="Wake up!",

            cancelbutton=None,

            show_special_characters_warning=None,

        ).finalvalue

        print(f"\n\nYour input was {i}")



        i = InputTimeout(

            timeout=10,

            input_message=" >> ",

            timeout_message="Sorry, you were not fast enough",

            defaultvalue="Are you sleeping?",

            cancelbutton="esc",

            show_special_characters_warning=None,

        ).finalvalue

        print(f"\n\nYour input was {i}")



        i = InputTimeout(

            timeout=10,

            input_message=" >>",

            timeout_message="Sorry, you were not fast enough",

            defaultvalue="you are so slow",

            cancelbutton=None,

            show_special_characters_warning='If you want to use special characters, you have to use alt+\\d\\d\\d\\d\nPress "ctrl" to see a complete list of all combinations!',

        ).finalvalue

        print(f"\n\nYour input was {i}")

```



Output: 



```python

    #output

    If you want to use special characters, you have to use alt+\d\d\d\d

Press "ctrl" to see a complete list of all combinations!

 >>  babba

Your input was babba

If you want to use special characters, you have to use alt+\d\d\d\d

Press "ctrl" to see a complete list of all combinations!

alt+0192    ->    À        alt+0193    ->    Á        alt+0196    ->    Ä        alt+0194    ->    Â        

alt+0195    ->    Ã        alt+0197    ->    Å        alt+0198    ->    Æ        alt+0228    ->    ä        

alt+0224    ->    à        alt+0225    ->    á        alt+0226    ->    â        alt+0227    ->    ã        

alt+0229    ->    å        alt+0230    ->    æ        alt+0199    ->    Ç        alt+0231    ->    ç        

alt+0208    ->    Ð        alt+0240    ->    ð        alt+0203    ->    Ë        alt+0200    ->    È        

alt+0201    ->    É        alt+0202    ->    Ê        alt+0235    ->    ë        alt+0232    ->    è        

alt+0233    ->    é        alt+0234    ->    ê        alt+0207    ->    Ï        alt+0204    ->    Ì        

alt+0205    ->    Í        alt+0206    ->    Î        alt+0239    ->    ï        alt+0236    ->    ì        

alt+0237    ->    í        alt+0238    ->    î        alt+0209    ->    Ñ        alt+0241    ->    ñ        

alt+0214    ->    Ö        alt+0210    ->    Ò        alt+0211    ->    Ó        alt+0212    ->    Ô        

alt+0213    ->    Õ        alt+0216    ->    Ø        alt+0140    ->    Œ        alt+0246    ->    ö        

alt+0242    ->    ò        alt+0243    ->    ó        alt+0244    ->    ô        alt+0245    ->    õ        

alt+0248    ->    ø        alt+0156    ->    œ        alt+0138    ->    Š        alt+0223    ->    ß        

alt+0154    ->    š        alt+0222    ->    Þ        alt+0254    ->    þ        alt+0220    ->    Ü        

alt+0217    ->    Ù        alt+0218    ->    Ú        alt+0219    ->    Û        alt+0252    ->    ü        

alt+0249    ->    ù        alt+0250    ->    ú        alt+0251    ->    û        alt+0159    ->    Ÿ        

alt+0221    ->    Ý        alt+0255    ->    ÿ        alt+0253    ->    ý        alt+0168    ->    ¨        

alt+0136    ->    ˆ        alt+0180    ->    ´        alt+0175    ->    ¯        alt+0184    ->    ¸        

alt+0192    ->    À        alt+0193    ->    Á        alt+0196    ->    Ä        alt+0194    ->    Â        

alt+0195    ->    Ã        alt+0197    ->    Å        alt+0198    ->    Æ        alt+0228    ->    ä        

alt+0224    ->    à        alt+0225    ->    á        alt+0226    ->    â        alt+0227    ->    ã        

alt+0229    ->    å        alt+0230    ->    æ        alt+0199    ->    Ç        alt+0231    ->    ç        

alt+0208    ->    Ð        alt+0240    ->    ð        alt+0203    ->    Ë        alt+0200    ->    È        

alt+0201    ->    É        alt+0202    ->    Ê        alt+0235    ->    ë        alt+0232    ->    è        

alt+0233    ->    é        alt+0234    ->    ê        alt+0207    ->    Ï        alt+0204    ->    Ì        

alt+0205    ->    Í        alt+0206    ->    Î        alt+0239    ->    ï        alt+0236    ->    ì        

alt+0237    ->    í        alt+0238    ->    î        alt+0209    ->    Ñ        alt+0241    ->    ñ        

alt+0214    ->    Ö        alt+0210    ->    Ò        alt+0211    ->    Ó        alt+0212    ->    Ô        

alt+0213    ->    Õ        alt+0216    ->    Ø        alt+0140    ->    Œ        alt+0246    ->    ö        

alt+0242    ->    ò        alt+0243    ->    ó        alt+0244    ->    ô        alt+0245    ->    õ        

alt+0248    ->    ø        alt+0156    ->    œ        alt+0138    ->    Š        alt+0223    ->    ß        

alt+0154    ->    š        alt+0222    ->    Þ        alt+0254    ->    þ        alt+0220    ->    Ü        

alt+0217    ->    Ù        alt+0218    ->    Ú        alt+0219    ->    Û        alt+0252    ->    ü        

alt+0249    ->    ù        alt+0250    ->    ú        alt+0251    ->    û        alt+0159    ->    Ÿ        

alt+0221    ->    Ý        alt+0255    ->    ÿ        alt+0253    ->    ý        alt+0168    ->    ¨        

alt+0136    ->    ˆ        alt+0180    ->    ´        alt+0175    ->    ¯        alt+0184    ->    ¸        

Sorry, you were not fast enough: 

Your input was slow

 >>  super

Your input was super

 >>  adasa

Your input was adasa

If you want to use special characters, you have to use alt+\d\d\d\d

Press "ctrl" to see a complete list of all combinations!

Sorry, you were not fast enough

Your input was you are so slow

```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/input_timeout",
    "name": "input-timeout",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "timeout,input,default,value",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fc/e3/ffdbfe8066e55d8c8318d2aedf4f4eeb82b36860c60f1599fb0b4f87b93a/input_timeout-0.21.tar.gz",
    "platform": null,
    "description": "\n# input_timeout\n\n\n\nDefine how long you want to wait for the user's input.\n\nAfter the time is over, a default value is set. \n\n\n\n### Install it:\n\n\n\n```python\n\npip install input-timeout\n\n```\n\n\n\n### Use it:\n\n\n\n```python\n\nfrom input_timeout import InputTimeout\n\n\n\n        i = InputTimeout(\n\n            timeout=20,\n\n            input_message=\" >> \",\n\n            timeout_message=\"'Sorry, you were not fast enough'\",\n\n            defaultvalue=\"slow\",\n\n            cancelbutton=\"esc\",\n\n            show_special_characters_warning='If you want to use special characters, you have to use alt+\\\\d\\\\d\\\\d\\\\d\\nPress \"ctrl\" to see a complete list of all combinations!',\n\n        ).finalvalue\n\n        print(f\"\\n\\nYour input was {i}\")\n\n\n\n        i = InputTimeout(\n\n            timeout=5,\n\n            input_message=\" >> \",\n\n            timeout_message=\"Sorry, you were not fast enough: \",\n\n            defaultvalue=\"slow\",\n\n            cancelbutton=\"esc\",\n\n            show_special_characters_warning='If you want to use special characters, you have to use alt+\\\\d\\\\d\\\\d\\\\d\\nPress \"ctrl\" to see a complete list of all combinations!',\n\n        ).finalvalue\n\n        print(f\"\\n\\nYour input was {i}\")\n\n\n\n        i = InputTimeout(\n\n            timeout=10,\n\n            input_message=\" >> \",\n\n            timeout_message=\"Sorry, you were not fast enough\",\n\n            defaultvalue=\"Wake up!\",\n\n            cancelbutton=None,\n\n            show_special_characters_warning=None,\n\n        ).finalvalue\n\n        print(f\"\\n\\nYour input was {i}\")\n\n\n\n        i = InputTimeout(\n\n            timeout=10,\n\n            input_message=\" >> \",\n\n            timeout_message=\"Sorry, you were not fast enough\",\n\n            defaultvalue=\"Are you sleeping?\",\n\n            cancelbutton=\"esc\",\n\n            show_special_characters_warning=None,\n\n        ).finalvalue\n\n        print(f\"\\n\\nYour input was {i}\")\n\n\n\n        i = InputTimeout(\n\n            timeout=10,\n\n            input_message=\" >>\",\n\n            timeout_message=\"Sorry, you were not fast enough\",\n\n            defaultvalue=\"you are so slow\",\n\n            cancelbutton=None,\n\n            show_special_characters_warning='If you want to use special characters, you have to use alt+\\\\d\\\\d\\\\d\\\\d\\nPress \"ctrl\" to see a complete list of all combinations!',\n\n        ).finalvalue\n\n        print(f\"\\n\\nYour input was {i}\")\n\n```\n\n\n\nOutput: \n\n\n\n```python\n\n    #output\n\n    If you want to use special characters, you have to use alt+\\d\\d\\d\\d\n\nPress \"ctrl\" to see a complete list of all combinations!\n\n >>  babba\n\nYour input was babba\n\nIf you want to use special characters, you have to use alt+\\d\\d\\d\\d\n\nPress \"ctrl\" to see a complete list of all combinations!\n\nalt+0192    ->    \u00c0        alt+0193    ->    \u00c1        alt+0196    ->    \u00c4        alt+0194    ->    \u00c2        \n\nalt+0195    ->    \u00c3        alt+0197    ->    \u00c5        alt+0198    ->    \u00c6        alt+0228    ->    \u00e4        \n\nalt+0224    ->    \u00e0        alt+0225    ->    \u00e1        alt+0226    ->    \u00e2        alt+0227    ->    \u00e3        \n\nalt+0229    ->    \u00e5        alt+0230    ->    \u00e6        alt+0199    ->    \u00c7        alt+0231    ->    \u00e7        \n\nalt+0208    ->    \u00d0        alt+0240    ->    \u00f0        alt+0203    ->    \u00cb        alt+0200    ->    \u00c8        \n\nalt+0201    ->    \u00c9        alt+0202    ->    \u00ca        alt+0235    ->    \u00eb        alt+0232    ->    \u00e8        \n\nalt+0233    ->    \u00e9        alt+0234    ->    \u00ea        alt+0207    ->    \u00cf        alt+0204    ->    \u00cc        \n\nalt+0205    ->    \u00cd        alt+0206    ->    \u00ce        alt+0239    ->    \u00ef        alt+0236    ->    \u00ec        \n\nalt+0237    ->    \u00ed        alt+0238    ->    \u00ee        alt+0209    ->    \u00d1        alt+0241    ->    \u00f1        \n\nalt+0214    ->    \u00d6        alt+0210    ->    \u00d2        alt+0211    ->    \u00d3        alt+0212    ->    \u00d4        \n\nalt+0213    ->    \u00d5        alt+0216    ->    \u00d8        alt+0140    ->    \u0152        alt+0246    ->    \u00f6        \n\nalt+0242    ->    \u00f2        alt+0243    ->    \u00f3        alt+0244    ->    \u00f4        alt+0245    ->    \u00f5        \n\nalt+0248    ->    \u00f8        alt+0156    ->    \u0153        alt+0138    ->    \u0160        alt+0223    ->    \u00df        \n\nalt+0154    ->    \u0161        alt+0222    ->    \u00de        alt+0254    ->    \u00fe        alt+0220    ->    \u00dc        \n\nalt+0217    ->    \u00d9        alt+0218    ->    \u00da        alt+0219    ->    \u00db        alt+0252    ->    \u00fc        \n\nalt+0249    ->    \u00f9        alt+0250    ->    \u00fa        alt+0251    ->    \u00fb        alt+0159    ->    \u0178        \n\nalt+0221    ->    \u00dd        alt+0255    ->    \u00ff        alt+0253    ->    \u00fd        alt+0168    ->    \u00a8        \n\nalt+0136    ->    \u02c6        alt+0180    ->    \u00b4        alt+0175    ->    \u00af        alt+0184    ->    \u00b8        \n\nalt+0192    ->    \u00c0        alt+0193    ->    \u00c1        alt+0196    ->    \u00c4        alt+0194    ->    \u00c2        \n\nalt+0195    ->    \u00c3        alt+0197    ->    \u00c5        alt+0198    ->    \u00c6        alt+0228    ->    \u00e4        \n\nalt+0224    ->    \u00e0        alt+0225    ->    \u00e1        alt+0226    ->    \u00e2        alt+0227    ->    \u00e3        \n\nalt+0229    ->    \u00e5        alt+0230    ->    \u00e6        alt+0199    ->    \u00c7        alt+0231    ->    \u00e7        \n\nalt+0208    ->    \u00d0        alt+0240    ->    \u00f0        alt+0203    ->    \u00cb        alt+0200    ->    \u00c8        \n\nalt+0201    ->    \u00c9        alt+0202    ->    \u00ca        alt+0235    ->    \u00eb        alt+0232    ->    \u00e8        \n\nalt+0233    ->    \u00e9        alt+0234    ->    \u00ea        alt+0207    ->    \u00cf        alt+0204    ->    \u00cc        \n\nalt+0205    ->    \u00cd        alt+0206    ->    \u00ce        alt+0239    ->    \u00ef        alt+0236    ->    \u00ec        \n\nalt+0237    ->    \u00ed        alt+0238    ->    \u00ee        alt+0209    ->    \u00d1        alt+0241    ->    \u00f1        \n\nalt+0214    ->    \u00d6        alt+0210    ->    \u00d2        alt+0211    ->    \u00d3        alt+0212    ->    \u00d4        \n\nalt+0213    ->    \u00d5        alt+0216    ->    \u00d8        alt+0140    ->    \u0152        alt+0246    ->    \u00f6        \n\nalt+0242    ->    \u00f2        alt+0243    ->    \u00f3        alt+0244    ->    \u00f4        alt+0245    ->    \u00f5        \n\nalt+0248    ->    \u00f8        alt+0156    ->    \u0153        alt+0138    ->    \u0160        alt+0223    ->    \u00df        \n\nalt+0154    ->    \u0161        alt+0222    ->    \u00de        alt+0254    ->    \u00fe        alt+0220    ->    \u00dc        \n\nalt+0217    ->    \u00d9        alt+0218    ->    \u00da        alt+0219    ->    \u00db        alt+0252    ->    \u00fc        \n\nalt+0249    ->    \u00f9        alt+0250    ->    \u00fa        alt+0251    ->    \u00fb        alt+0159    ->    \u0178        \n\nalt+0221    ->    \u00dd        alt+0255    ->    \u00ff        alt+0253    ->    \u00fd        alt+0168    ->    \u00a8        \n\nalt+0136    ->    \u02c6        alt+0180    ->    \u00b4        alt+0175    ->    \u00af        alt+0184    ->    \u00b8        \n\nSorry, you were not fast enough: \n\nYour input was slow\n\n >>  super\n\nYour input was super\n\n >>  adasa\n\nYour input was adasa\n\nIf you want to use special characters, you have to use alt+\\d\\d\\d\\d\n\nPress \"ctrl\" to see a complete list of all combinations!\n\nSorry, you were not fast enough\n\nYour input was you are so slow\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Like python's input(), but with timeout and default value",
    "version": "0.21",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/input_timeout"
    },
    "split_keywords": [
        "timeout",
        "input",
        "default",
        "value"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00a306e8f1483545217d55d1edf5d5fba3411665c61ffc40e920046686c0aaf0",
                "md5": "db19dc5d48cda46ca2a6d33939602d2e",
                "sha256": "aca6bf102d082ab5b5396d6677bb8fe0cef3c3a045b1dd12625952ad67f44548"
            },
            "downloads": -1,
            "filename": "input_timeout-0.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db19dc5d48cda46ca2a6d33939602d2e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7455,
            "upload_time": "2022-10-02T05:31:08",
            "upload_time_iso_8601": "2022-10-02T05:31:08.032661Z",
            "url": "https://files.pythonhosted.org/packages/00/a3/06e8f1483545217d55d1edf5d5fba3411665c61ffc40e920046686c0aaf0/input_timeout-0.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fce3ffdbfe8066e55d8c8318d2aedf4f4eeb82b36860c60f1599fb0b4f87b93a",
                "md5": "bfe94df92718c8e871246afb0212afdf",
                "sha256": "d11301e08ea7506a73ddfa987d5afd4baf0dec8f048a9d2033cfa96471de4929"
            },
            "downloads": -1,
            "filename": "input_timeout-0.21.tar.gz",
            "has_sig": false,
            "md5_digest": "bfe94df92718c8e871246afb0212afdf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6212,
            "upload_time": "2022-10-02T05:31:10",
            "upload_time_iso_8601": "2022-10-02T05:31:10.023513Z",
            "url": "https://files.pythonhosted.org/packages/fc/e3/ffdbfe8066e55d8c8318d2aedf4f4eeb82b36860c60f1599fb0b4f87b93a/input_timeout-0.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-10-02 05:31:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "input_timeout",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "input-timeout"
}
        
Elapsed time: 1.15969s