Skip to main content

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:

  1. Simple menu
  2. Single selection menu
  3. Multi selection menu

project_menu license information Issues commits-since Made with python

Table of contents

  1. TODO
  2. Project Structure
    1. Examples
    2. Menu and data
    3. Requirements
  3. Installation
    1. Cloning the project and installing
    2. Using PyPI (Not yet supported)
    3. As a submodule in your own project
    4. Using setup.py to install (Not yet supported)
  4. Example Code
  5. Previews
    1. Example 1
    2. Example 2
    3. Example 3
    4. Example 4
    5. Example 5
    6. Example 6
  6. License

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:

  1. Menu with submenu
  2. Single selection menu
  3. 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:

  1. Cloning the project and installing
  2. Using PyPI (Not yet supported)
  3. As a submodule in your own project
  4. Using setup.py to install
  5. Using a release file from the repository

Cloning and installing

  1. Change directory to your own project where you are going to use the module
  2. git clone https://github.com/erikkamph/project_menu
  3. Add /project_menu/ to a .gitignore file as it should not be pushed to your own git repository, do this for every .gitignore.
  4. 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

  1. Enter the same git directory as your own project you want to add this to
  2. Execute following git submodule add https://github.com/erikkamph/project_menu. This will add the project as a submodule for your project.
  3. Check that it has been added by running git status
  4. See Example Code and see what you need to change to import it properly
  5. 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:

  1. git submodule init
  2. git submodule update

The steps for all of this can be found at Git - Submodules.

Using setup file to install

  1. Change directory to src/menu_zerobeef.
  2. Run python setup.py install to install.
  3. The project should be installed now.
  4. See Example Code

Using a release file

  1. Go to releases
  2. Download the latest file that ends in .whl
  3. In your project, if it has venv activate it.
  4. pip install <path_to_whl> where <path_to_whl> is the path to the newly downloaded .whl file.
  5. See Example Code for examples
  6. 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 1

Example 2

Example 2

Example 3

Example 3

Example 4

Example 4

Example 5

Example 5

Example 6

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

This version

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

menu_zerobeef-0.2.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

menu_zerobeef-0.2-py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page