# TUI-Menu
This is a Python Module for Menu driven TUI scripts
It helps developers to write menu-driven scripts (or apps) in a simple way.
## Installation
You have two wayes to install and use this module:
* Use pip to install it
```bash
pip install tui-menu
```
* Copy the `tui-menu/Menu.py` to your project
### Usage
An example of using this module.
```python
from tui_menu.Menu import Menu
# Create main menu
main_menu = Menu()
# Creating sub-menu
sub_menu = Menu()
# Setting up the title and menu level
main_manu.title("My Application main menu")
main_menu.level(0)
sub_menu.title("My Application sub menu")
sub_menu.level(1)
sub_menu.add_item(key="1", name="running option 2", data=op_func2)
main_menu.add_item(key="1", name="running option 1", data=op_func1)
main_menu.add_item(key="2", name="sub menu 1", data=sub_menu)
# Create functions for menu operations
def op_func1():
# do something
def op_func2():
# do something
# running the application
main_menu.run()
```
You can create as many as you want of sub-menus, each sub menu is a Menu object.
Every Menu item can be a Menu object (sub-menu) or a Function which can be call and
execute some operation.
The menu key is **one letter** key, you cannot use **'x'** or **'r'** which use for
* 'x' - exit the script / app
* 'r' - use in sub menu to return one level up
## Contributing
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
This Module is distributing under the [GPLv3+](https://www.gnu.org/licenses/gpl-3.0.html)
Licensing
Raw data
{
"_id": null,
"home_page": "https://github.com/avili68/tui-menu",
"name": "tui-menu",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "Avi Liani <avi@liani.co.il>",
"keywords": "console,menu,tui",
"author": "Avi Liani",
"author_email": "Avi Liani <avi@liani.co.il>",
"download_url": "https://files.pythonhosted.org/packages/28/58/1e5cef1c2f56744e2d3f0053abf9b58130f9336acd23fcc0f6b311cd2730/tui_menu-0.1.7.tar.gz",
"platform": null,
"description": "# TUI-Menu\n\nThis is a Python Module for Menu driven TUI scripts\n\nIt helps developers to write menu-driven scripts (or apps) in a simple way.\n\n## Installation\n\nYou have two wayes to install and use this module:\n* Use pip to install it\n\n```bash\npip install tui-menu\n```\n* Copy the `tui-menu/Menu.py` to your project \n\n### Usage\n\nAn example of using this module.\n\n```python\nfrom tui_menu.Menu import Menu\n\n# Create main menu\nmain_menu = Menu()\n\n# Creating sub-menu\nsub_menu = Menu()\n\n# Setting up the title and menu level\nmain_manu.title(\"My Application main menu\")\nmain_menu.level(0)\n\nsub_menu.title(\"My Application sub menu\")\nsub_menu.level(1)\n\nsub_menu.add_item(key=\"1\", name=\"running option 2\", data=op_func2)\n\nmain_menu.add_item(key=\"1\", name=\"running option 1\", data=op_func1)\nmain_menu.add_item(key=\"2\", name=\"sub menu 1\", data=sub_menu)\n\n# Create functions for menu operations\ndef op_func1():\n # do something\n\ndef op_func2():\n # do something\n\n# running the application\nmain_menu.run()\n```\nYou can create as many as you want of sub-menus, each sub menu is a Menu object.\n\nEvery Menu item can be a Menu object (sub-menu) or a Function which can be call and \nexecute some operation.\n\nThe menu key is **one letter** key, you cannot use **'x'** or **'r'** which use for\n* 'x' - exit the script / app\n* 'r' - use in sub menu to return one level up\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first\nto discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\nThis Module is distributing under the [GPLv3+](https://www.gnu.org/licenses/gpl-3.0.html)\n Licensing\n",
"bugtrack_url": null,
"license": "",
"summary": "A module for TUI Menu driven application",
"version": "0.1.7",
"project_urls": {
"Homepage": "https://github.com/avili68/tui-menu",
"Repository": "https://github.com/avili68/tui-menu"
},
"split_keywords": [
"console",
"menu",
"tui"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "28581e5cef1c2f56744e2d3f0053abf9b58130f9336acd23fcc0f6b311cd2730",
"md5": "c1d20abe38bc13ce7bbba50c07dd71c5",
"sha256": "e2160bdd2f57481777cc9e1fda1096209e064b76c613fdc2ec50d7d2e96537c6"
},
"downloads": -1,
"filename": "tui_menu-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "c1d20abe38bc13ce7bbba50c07dd71c5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 17193,
"upload_time": "2023-07-06T20:15:26",
"upload_time_iso_8601": "2023-07-06T20:15:26.926173Z",
"url": "https://files.pythonhosted.org/packages/28/58/1e5cef1c2f56744e2d3f0053abf9b58130f9336acd23fcc0f6b311cd2730/tui_menu-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-06 20:15:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "avili68",
"github_project": "tui-menu",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tui-menu"
}