lw-menu


Namelw-menu JSON
Version 1.0.8 PyPI version JSON
download
home_pageNone
SummaryA short description of your package
upload_time2024-07-19 11:07:01
maintainerNone
docs_urlNone
authorlw
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# lw_menu

[![Downloads](https://static.pepy.tech/badge/dumb-menu)](https://pepy.tech/project/dumb-menu)

simple_term_menu don't support windows, so I made dumb_menu.

dumb_menu is not as powerful as simple_term_menu , but this a **GOOD OLD MENU** .

dumb_menu is a light weight command line menu that supports **Windows**, **MacOS**, and **Linux**.


## Installation

```
pip install lw-menu
```

https://pypi.org/project/dumb-menu/

https://github.com/cornradio/dumb_menu (I want stars ⭐ uwu)

## Usage

example:

```python
import lw_menu
options = ["[1]Option 1", "[2]Option 2", "[3]Option 3","[q]quit"]
index = lw_menu.get_menu_choice(options)
print(f"You selected option {index + 1}: {options[index]}")
```


![png](https://raw.githubusercontent.com/cornradio/imgs/main/20230214163952.png)

another example:

```python
import os
import lw_menu

def loopmenu():
    options = ["[1]happy",
            "[2]sad",
            "[3]give me a cookie",
            "[q]quit"]
    index = lw_menu.get_menu_choice(options,isclean = True)
    # clear screen, cls for windows, clear for linux
    os.system('cls') 
    # Python 3.10+ only,old version could use if-else
    match index:
        case 0:
            print(":)")
        case 1:
            print(":(")
        case 2:
            print("🍪ヾ(•ω•`)o")
        case 3:
            exit()
    input('Press ENTER to continue...')

if __name__ == "__main__":
    while True:
        loopmenu()
```
![Imgur](https://i.imgur.com/7zjLt8g.png)


## Get help

Get help ➡️ [Github issue](https://github.com/cornradio/dumb_menu/issues)

## Update log


`1.0.8` add "return key string" option , add `demo.py`  As a straightforward example

```python
lw_menu.get_menu_choice(options,give_key_str = True)
```

`1.0.7` fix "flickering on mac zsh" 

`1.0.6` forget write log in 1.0.5

`1.0.5` fix bug in 1.0.4

`1.0.4` support "clean mode" 

`1.0.3` show selected index also when using hotkey  

`1.0.2` first useable version

`1.0.1` fix bug

`1.0.0` first release

## how to upload a new version (for me)

en: https://packaging.python.org/tutorials/packaging-projects/ 

zh: https://python-packaging-zh.readthedocs.io/zh_CN/latest/minimal.html#id2

> make sure have twine installed first

1. change `setup.py`
2. testing `python3 setup.py develop`
3. `python3 setup.py sdist`
4. `twine upload dist/*`

test code :
```
python3

import dumb_menu
dumb_menu.demo()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "lw-menu",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "lw",
    "author_email": "2976638734@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/1e/1f/16f1c619e14b57235810699a454b0a51cd550a04f6050746de8e81783e69/lw_menu-1.0.8.tar.gz",
    "platform": null,
    "description": "\r\n# lw_menu\r\n\r\n[![Downloads](https://static.pepy.tech/badge/dumb-menu)](https://pepy.tech/project/dumb-menu)\r\n\r\nsimple_term_menu don't support windows, so I made dumb_menu.\r\n\r\ndumb_menu is not as powerful as simple_term_menu , but this a **GOOD OLD MENU** .\r\n\r\ndumb_menu is a light weight command line menu that supports **Windows**, **MacOS**, and **Linux**.\r\n\r\n\r\n## Installation\r\n\r\n```\r\npip install lw-menu\r\n```\r\n\r\nhttps://pypi.org/project/dumb-menu/\r\n\r\nhttps://github.com/cornradio/dumb_menu (I want stars \u2b50 uwu)\r\n\r\n## Usage\r\n\r\nexample:\r\n\r\n```python\r\nimport lw_menu\r\noptions = [\"[1]Option 1\", \"[2]Option 2\", \"[3]Option 3\",\"[q]quit\"]\r\nindex = lw_menu.get_menu_choice(options)\r\nprint(f\"You selected option {index + 1}: {options[index]}\")\r\n```\r\n\r\n\r\n![png](https://raw.githubusercontent.com/cornradio/imgs/main/20230214163952.png)\r\n\r\nanother example:\r\n\r\n```python\r\nimport os\r\nimport lw_menu\r\n\r\ndef loopmenu():\r\n    options = [\"[1]happy\",\r\n            \"[2]sad\",\r\n            \"[3]give me a cookie\",\r\n            \"[q]quit\"]\r\n    index = lw_menu.get_menu_choice(options,isclean = True)\r\n    # clear screen, cls for windows, clear for linux\r\n    os.system('cls') \r\n    # Python 3.10+ only,old version could use if-else\r\n    match index:\r\n        case 0:\r\n            print(\":)\")\r\n        case 1:\r\n            print(\":(\")\r\n        case 2:\r\n            print(\"\ud83c\udf6a\u30fe(\u2022\u03c9\u2022`)o\")\r\n        case 3:\r\n            exit()\r\n    input('Press ENTER to continue...')\r\n\r\nif __name__ == \"__main__\":\r\n    while True:\r\n        loopmenu()\r\n```\r\n![Imgur](https://i.imgur.com/7zjLt8g.png)\r\n\r\n\r\n## Get help\r\n\r\nGet help \u27a1\ufe0f [Github issue](https://github.com/cornradio/dumb_menu/issues)\r\n\r\n## Update log\r\n\r\n\r\n`1.0.8` add \"return key string\" option , add `demo.py`  As a straightforward example\r\n\r\n```python\r\nlw_menu.get_menu_choice(options,give_key_str = True)\r\n```\r\n\r\n`1.0.7` fix \"flickering on mac zsh\" \r\n\r\n`1.0.6` forget write log in 1.0.5\r\n\r\n`1.0.5` fix bug in 1.0.4\r\n\r\n`1.0.4` support \"clean mode\" \r\n\r\n`1.0.3` show selected index also when using hotkey  \r\n\r\n`1.0.2` first useable version\r\n\r\n`1.0.1` fix bug\r\n\r\n`1.0.0` first release\r\n\r\n## how to upload a new version (for me)\r\n\r\nen: https://packaging.python.org/tutorials/packaging-projects/ \r\n\r\nzh: https://python-packaging-zh.readthedocs.io/zh_CN/latest/minimal.html#id2\r\n\r\n> make sure have twine installed first\r\n\r\n1. change `setup.py`\r\n2. testing `python3 setup.py develop`\r\n3. `python3 setup.py sdist`\r\n4. `twine upload dist/*`\r\n\r\ntest code :\r\n```\r\npython3\r\n\r\nimport dumb_menu\r\ndumb_menu.demo()\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A short description of your package",
    "version": "1.0.8",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e1f16f1c619e14b57235810699a454b0a51cd550a04f6050746de8e81783e69",
                "md5": "4fef6f98744d7a278a57dbe5ea0e5963",
                "sha256": "984fb88fa99a65dd9cc63d1905b385a79540c3351cffa0f828f7a5ab8a5aab92"
            },
            "downloads": -1,
            "filename": "lw_menu-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "4fef6f98744d7a278a57dbe5ea0e5963",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4217,
            "upload_time": "2024-07-19T11:07:01",
            "upload_time_iso_8601": "2024-07-19T11:07:01.900997Z",
            "url": "https://files.pythonhosted.org/packages/1e/1f/16f1c619e14b57235810699a454b0a51cd550a04f6050746de8e81783e69/lw_menu-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-19 11:07:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "lw-menu"
}
        
lw
Elapsed time: 1.51277s