{ "info": { "author": "John Gresl", "author_email": "j.gresl12@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# py_menu\n\npy_menu is an easily configurable python API for creating command-line-based menu interfaces. This package is intended to be used on any python version >= 3.0.\n\n### Installation\nInstallation is simple! Activate your prefered python environment, if you want, and then run:\n```sh\npython -m pip install py_menu\n```\n\nOnce installed, you can `import py_menu` anywhere!\n\n### Getting Started\nThere should be several examples in the `py_menu/py_menu/examples` directory that you can run. If you wanted to run `low_level_example.py`, then simply open a python interpretter and enter:\n```python\nimport py_menu.examples.low_level_example\n```\nYou will immediately see an example Date/Time menu:\n```\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n ~!~ Date/Time example of py_menu ~!~\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nDate/Time Menu\n 1. Time Information\n 2. Date Information\n q. Quit program\n>>\n```\n\nPlay around, but the interface here is pretty self explanatory. \n\n### Included Classes\nThe py_menu API exposes two classes available for use by the developer: Option and Menu. Options are used as entries to a larger Menu whereas the Menu is displayed to the user.\n\n#### Option\nUsage: `Option(name, action[, flags])`:\n* `name`: type `str` - The name of the option. This will be displayed.\n* `action`: callable or type `Menu` - The action to take when this option is selected. If it is a callable, it will be `__call__`-ed. If it is a `Menu` object, control will be transfered to this `Menu` and whatever the current `Menu` was will be set as the previous `Menu`. [This is an implementation detail in `Menu`!!!]\n* `flags`: Not implemented for the base `Option` and `Menu` classes. The definition of flags can be set by whoever inherits from Option or Menu.\n\n```python\nopt1 = Option(\"This is Option1\", action = lambda: print(\"Hello!\"))\n```\n\n#### Menu\nUsage: `Menu(header, [options=None, splash=\"\"]):`\n* `heade`r: type `str` - The message to be displayed at the top of the menu.\n* `options`: `[Option]` - A list of Option objects to be displayed.\n* `splash`: type `str` - A single message to display when mainloop begins. For nested Menu objects, the splash message will ONLY be printed for the initial object that calls mainloop. \n\n```python\nmenu1 = Menu(\"Pick an option!\", [opt1], splash = \"Welcome to the Menu!\")\n```\n\n\n#### Full Example\nThis is from `add_option_example.py`\n```python\n\"\"\"\nFor this example, we'll be creating a very basic menu capable of displaying\nthe date and time information. We will be creating the same Menu from\nlow_level_example.py but we will be using the Menu.add_option method which\nimproves the readability!\n\nFor this example, the layout of the menu is as follows:\n\n | 1. Time information---|\n | | 1. Display Current Hour |\n | | 2. Display Current Minute | This is the\n | | 3. Display Current Second | Time menu\n | | 4. Display Current Time |\n | \n | 2. Date Information---|\n | | 1. Display Current Month |\n | | 2. Display Current Day | This is the\n | | 3. Display Current Year | date menu\n | | 4. Display Current Date |\n | |\n\n\"\"\"\nfrom py_menu import Menu, Option\n\n# We define the functions we will call to retrieve the date information\nimport datetime\ndef format_now(frmt):\n print(datetime.datetime.now().strftime(frmt))\n return\n\nsplash = \"\"\"\\\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n ~!~ Date/Time example of py_menu ~!~\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\"\"\"\n\n# We start by making all of the menus\nmain_menu = Menu(header = \"Pick an option!\", splash = splash)\ntime_menu = Menu(header = \"Time Information\")\ndate_menu = Menu(header = \"Date Information\")\n\n# We can add the secondary menus to the main menu now. The arguments passed to\n# menu.add_option are the same as you would use when creating an Option object.\nmain_menu.add_option(\"Time Information\", time_menu)\nmain_menu.add_option(\"Date Information\", date_menu)\n\n# Now we add the options to the time and date menus. This can be done before or\n# after the previous step. Once the initial menu object are created, options\n# can be added at any time.\ntime_menu.add_option(\"Display Current Hour\", lambda: format_now(\"%H\"))\ntime_menu.add_option(\"Display Current Minute\", lambda: format_now(\"%M\"))\ntime_menu.add_option(\"Display Current Second\", lambda: format_now(\"%S\"))\ntime_menu.add_option(\"Display Current Time\", lambda: format_now(\"%H:%M:%S\"))\n\ndate_menu.add_option(\"Display Current Month\", lambda: format_now(\"%B\"))\ndate_menu.add_option(\"Display Current Day\", lambda: format_now(\"%d\"))\ndate_menu.add_option(\"Display Current Year\", lambda: format_now(\"%y\"))\ndate_menu.add_option(\"Display Current Date\", lambda: format_now(\"%B %d, %y\"))\n\n# And then we start the mainloop!\nmain_menu.mainloop()\n\n# MUCH easier to understand compared to the low level example!\n\n```\n\n# Development\n\nWant to contribute? Great!\n\nFeel free to fork and create a pull request! I don't bite! \n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SyntaxVoid/py_menu", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "py-menu", "package_url": "https://pypi.org/project/py-menu/", "platform": "", "project_url": "https://pypi.org/project/py-menu/", "project_urls": { "Homepage": "https://github.com/SyntaxVoid/py_menu" }, "release_url": "https://pypi.org/project/py-menu/1.1.0/", "requires_dist": null, "requires_python": ">=3.0", "summary": "Command-line driven menu interface in python", "version": "1.1.0" }, "last_serial": 5975408, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "222414f2f964024e26995c8f8e6ae4f2", "sha256": "c116a75b5e299ebcbee3c6de5e9057c26aa2e28914a208713791ba7acf5a0fdc" }, "downloads": -1, "filename": "py_menu-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "222414f2f964024e26995c8f8e6ae4f2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2208, "upload_time": "2019-09-27T06:08:01", "url": "https://files.pythonhosted.org/packages/72/20/b924c8555f0f0fdb812d438dd3d13e2b262e895ff28b3d06177f0de9b602/py_menu-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f72c5fc9d573f1bc28539feca99e9ce3", "sha256": "421c324b28e130017923d5e6532232a5bfc4cf44cbc4a64ca6cf2b96506cf9a9" }, "downloads": -1, "filename": "py_menu-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f72c5fc9d573f1bc28539feca99e9ce3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 1141, "upload_time": "2019-09-27T06:08:04", "url": "https://files.pythonhosted.org/packages/b3/a3/4a8ed525e8416877127e4635b15fa1c81b2e7aa31ea660b4d90ec0588b74/py_menu-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "46e9f647cbd0ac8d75454a5317ccc8c6", "sha256": "b3a3c772a3863dd40b22a266884f597ec1b90e361156955e1399d27b4b5440b0" }, "downloads": -1, "filename": "py_menu-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "46e9f647cbd0ac8d75454a5317ccc8c6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2227, "upload_time": "2019-09-27T06:31:10", "url": "https://files.pythonhosted.org/packages/2f/f6/4a382c5647244f48e823c342230631fb6e1d7d2c66f918774ffa044bef26/py_menu-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ffd4ccbce829302d339bd387febeb6a", "sha256": "27df3fd9d74c176df1581d7c8d87369d3e482de0d76606b18a9d9102f67acce7" }, "downloads": -1, "filename": "py_menu-0.0.2.tar.gz", "has_sig": false, "md5_digest": "2ffd4ccbce829302d339bd387febeb6a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 1153, "upload_time": "2019-09-27T06:31:13", "url": "https://files.pythonhosted.org/packages/d7/d9/3091837847a0542f1095cfc0cdab86b70dd8cef7992a4b0107ce227fee85/py_menu-0.0.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "ec677161fa5e1a918b19133a3110b163", "sha256": "5903f11adbc9d5191fea913202899d8c3da3cf9426e1a84a16610c48388f21bb" }, "downloads": -1, "filename": "py_menu-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ec677161fa5e1a918b19133a3110b163", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 8343, "upload_time": "2019-10-04T06:15:52", "url": "https://files.pythonhosted.org/packages/41/4b/396b8919a48aa7396da35ef5147a278363a8797fd3b9afdd05dd3c442a43/py_menu-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d83bb8ce9348c371834ce7c58ae05f7", "sha256": "9ae00cf0e767ce38cbbbdc01f2e8fa24f497fffad82d5a614c58f03aa9f4a7a9" }, "downloads": -1, "filename": "py_menu-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9d83bb8ce9348c371834ce7c58ae05f7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 6295, "upload_time": "2019-10-04T06:15:55", "url": "https://files.pythonhosted.org/packages/b5/71/8c69229095f647dd91049b39136b68627fa422977675e7b93b158e471a54/py_menu-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "45cede0a71670bd6fb9aaf75ab1a8ad6", "sha256": "0a6f593c999a48b74141e224a58ff2e5a127b6b43b773fb11cae96de625cd8e1" }, "downloads": -1, "filename": "py_menu-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "45cede0a71670bd6fb9aaf75ab1a8ad6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 8335, "upload_time": "2019-10-04T06:35:24", "url": "https://files.pythonhosted.org/packages/e4/6a/93d35f164d2d604ea5c0178a44a4b9127f451d8d20e59c9969703174d51b/py_menu-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31abe910ea369307127f08024c388527", "sha256": "ba9dedabf6caad9df9c4b19bf56015f76ca58b2df1e1b15db5a613dde6fc46a0" }, "downloads": -1, "filename": "py_menu-1.0.1.tar.gz", "has_sig": false, "md5_digest": "31abe910ea369307127f08024c388527", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 6296, "upload_time": "2019-10-04T06:35:27", "url": "https://files.pythonhosted.org/packages/d3/92/aed7160847c5dcd0dc5aae1d4561f9129e47abb8a7fbaf959f4f9f0ef511/py_menu-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "3525aae39a3d7432f71bfcef207da347", "sha256": "db313510f09329978e33add9b4aa95da569c8ffa90aadd304299ae3a06c8378d" }, "downloads": -1, "filename": "py_menu-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3525aae39a3d7432f71bfcef207da347", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 8569, "upload_time": "2019-10-06T06:21:18", "url": "https://files.pythonhosted.org/packages/a5/81/c1a884f92bc65c5b0cdf9bd175d22d20164054f54c5c4732f6adda37d4c5/py_menu-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69b7bbbf084ab04454474fc0eec3c838", "sha256": "59606939009e5f23a14950aafd7b17ff1715794bff883ee21a431ad580f43284" }, "downloads": -1, "filename": "py_menu-1.0.2.tar.gz", "has_sig": false, "md5_digest": "69b7bbbf084ab04454474fc0eec3c838", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 6536, "upload_time": "2019-10-06T06:21:22", "url": "https://files.pythonhosted.org/packages/6f/41/5f7ea0a9ab2675ef3b86331cf5df57e5d8c06781236789f9c16fd0f89be5/py_menu-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "ee988fb2700edc129bea14fbf93ee3ad", "sha256": "d26f5b12d70c530c6c658f9f2d4e03d4fd9e7675ad979f35e0a9ff847ef20421" }, "downloads": -1, "filename": "py_menu-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ee988fb2700edc129bea14fbf93ee3ad", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 9883, "upload_time": "2019-10-15T07:57:21", "url": "https://files.pythonhosted.org/packages/3e/54/fbf5e9e4c64180560f40634b560aca17a2cc4ce18420513ec19ac4ca2f88/py_menu-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cf44ce362e1137c7cc7673d36ffea892", "sha256": "1ef679d7bcf25bc587d87af21b2d9dd88ceb521dc8efdfef7200b8572ce711f7" }, "downloads": -1, "filename": "py_menu-1.1.0.tar.gz", "has_sig": false, "md5_digest": "cf44ce362e1137c7cc7673d36ffea892", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 8042, "upload_time": "2019-10-15T07:57:27", "url": "https://files.pythonhosted.org/packages/52/b8/cc756041db9364d34d7d9aafa58432077a4b43647561f822600e8232d0d3/py_menu-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ee988fb2700edc129bea14fbf93ee3ad", "sha256": "d26f5b12d70c530c6c658f9f2d4e03d4fd9e7675ad979f35e0a9ff847ef20421" }, "downloads": -1, "filename": "py_menu-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ee988fb2700edc129bea14fbf93ee3ad", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 9883, "upload_time": "2019-10-15T07:57:21", "url": "https://files.pythonhosted.org/packages/3e/54/fbf5e9e4c64180560f40634b560aca17a2cc4ce18420513ec19ac4ca2f88/py_menu-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cf44ce362e1137c7cc7673d36ffea892", "sha256": "1ef679d7bcf25bc587d87af21b2d9dd88ceb521dc8efdfef7200b8572ce711f7" }, "downloads": -1, "filename": "py_menu-1.1.0.tar.gz", "has_sig": false, "md5_digest": "cf44ce362e1137c7cc7673d36ffea892", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 8042, "upload_time": "2019-10-15T07:57:27", "url": "https://files.pythonhosted.org/packages/52/b8/cc756041db9364d34d7d9aafa58432077a4b43647561f822600e8232d0d3/py_menu-1.1.0.tar.gz" } ] }