A simple menu program for command line enthusiasts made possible using curses
Project description
Curses Menu
A simple menu application for command line enthusiasts written in Python using curses to be able to write on screen. There are three different types of menus that is available to the end user for the moment, these are:
- Simple menu
- Single selection menu
- Multi selection menu
Table of contents
TODO
- [ ] Fix setup.py
- [ ] Fix bugs that might appear over time
Project Structure
.
├── LICENSE.md
├── README.md
├── images
│ ├── Example1.png
│ ├── Example2.png
│ ├── Example3.png
│ ├── Example4.png
│ ├── Example5.png
│ └── Example6.png
├── pyproject.toml
├── requirements.txt
├── src
│ └── menu_zerobeef
│ ├── Pipfile
│ ├── Pipfile.lock
│ ├── __init__.py
│ ├── data.py
│ ├── example.py
│ ├── main.py
│ ├── menu.py
│ └── setup.py
└── tests
Examples
The examples are located in example.py. Currently there are three examples in that file. The exaples that are available are:
- Menu with submenu
- Single selection menu
- Multiple selection menu A quicker example can be found under Example Code.
Menu and data
menu.py and data.py contains the necceessary information to create your own menus. You can choose from the same menu types as in the previews, or define your own menu item by extending MenuItem class from data.py.
Requirements
Following is a shorter version of the requirements for running the project:
asttokens==2.0.5
colorama==0.4.5
executing==0.8.3
icecream==2.1.2
Pygments==2.12.0
six==1.16.0
More requirements can be found in requirements.txt
Installation
When installing in your own project, be sure to follow one of following steps:
- Cloning the project and installing
- Using PyPI (Not yet supported)
- As a submodule in your own project
- Using setup.py to install
- Using a release file from the repository
Cloning and installing
- Change directory to your own project where you are going to use the module
git clone https://github.com/erikkamph/project_menu
- Add
/project_menu/
to a.gitignore
file as it should not be pushed to your own git repository, do this for every.gitignore
. - See Example Code and see what you need to change and how to use.
Using PyPI
This method is not yet supported.
Creating a submodule in project
- Enter the same git directory as your own project you want to add this to
- Execute following
git submodule add https://github.com/erikkamph/project_menu
. This will add the project as a submodule for your project. - Check that it has been added by running
git status
- See Example Code and see what you need to change to import it properly
- Good work! You can now use the classes to create a menu.
Important regarding submodules
None of the code will follow for users of your project when using submodules.
Users that clone afterwards will need following steps:
git submodule init
git submodule update
The steps for all of this can be found at Git - Submodules.
Using setup file to install
- Change directory to
src/menu_zerobeef
. - Run
python setup.py install
to install. - The project should be installed now.
- See Example Code
Using a release file
- Go to releases
- Download the latest file that ends in
.whl
- In your project, if it has venv activate it.
pip install <path_to_whl>
where<path_to_whl>
is the path to the newly downloaded.whl
file.- See Example Code for examples
- You should be good to go.
Example Code
The following is an example that can be used to
show how to implement the menu. If you the project
using local methods such as git submodule
or git clone
,
you might have to change the first two rows from saying
from menu_zerobeef.data
in the beginning to
from project_menu.src.menu_zerobeef.data
.
from menu_zerobeef.data import (ItemMultiSelection, ItemSingleSelection,
MenuItem)
from menu_zerobeef.menu import ApplicationMenu
import curses
def test(stdscr):
curses.start_color()
curses.use_default_colors()
menu_title = "Muti Selection Test"
items = [ItemMultiSelection(str(i), i) for i in range(0, 33)]
test = ApplicationMenu(stdscr, (items, menu_title))
test.show_menu()
curses.wrapper(test)
Previews
Example 1
Example 2
Example 3
Example 4
Example 5
Example 6
License
The program was licensed under the MIT license, for more information see LICENSE.md or visit choosealicense.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for menu_zerobeef-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 257ebc9e206541dfdb78970a323a9bd3d413e620e239ab58dc23aa318eb1872c |
|
MD5 | a50bc40846830aa04ac31d184808401b |
|
BLAKE2b-256 | 5ca935beef4c8472b97ff6860c916869944ebda91e9fc8c9376e9ab4a6943553 |