Skip to main content

ASCII-Menus

ASCII_Menus is a simple library for creating different interactive menus

🚀 Features

  • Simple and legible menus: Menus with options in cell format, title and displayed through the terminal.
  • Custom size menu: Customizable size based on the number of options required, both in rows and columns.
  • Custom size options: Customize the number of characters per option.
  • Support for multiple pages of options
  • Simple Scroll-Bar system
  • Two interaction modes: Dynamic <--> Static.
  • With Cursor

🛠 Installation

 $ pip install ASCII-Menus

📖 Quick Start

Generate basic menu and show it

from ASCII_Menus import Menu

options_list = [
    "test", "....", "menu",
    "test", "....", "menu",
    "test", "....", "menu",
    "test", "....", "menu"
]

test_menu = Menu("test_menu", 3, 4, 5, options_list)
test_menu.show_frame_menu()
+-------------------------+
|        test_menu        |
|-------------------------|
|                         |
| > test    ....    menu  |
|                         |
|   test    ....    menu  |
|                         |
|   test    ....    menu  |
|                         |
|   test    ....    menu  |
+-------------------------+

Move cursor

...
input_user = MOVE_DOWN
test_menu.control_menu(input_user)
+-------------------------+
|        test_menu        |
|-------------------------|
|                         |
|   test    ....    menu  |
|                         |
| > test    ....    menu  |
|                         |
|   test    ....    menu  |
|                         |
|   test    ....    menu  |
+-------------------------+

Select option

Returns a str containing the option name, if the option contained a function, executes them.

...
input_user = OK_BUTTON
name_option = test_menu.control_menu(input_user)
print(name_option)
"test"

🌎 Real-World Examples

A short application example

from os import system
from src.ASCII_Menus import Menu

# Create the options
TEST_LIST = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l']
# To generate the Menu called "test_menu"
TEST_MENU = Menu("test_menu", 2, 3, 10, TEST_LIST)

# Functions you want to add to the menu
def f_01(x: int, y: int):...    
def f_02(x: int, y: int):...
def f_03(x: int, y: int):...
def f_04(x: int, y: int):...
def f_05(x: int, y: int):...    
def f_06(x: int, y: int):...    
def f_07(x: int, y: int):...
def f_08(x: int, y: int):...
def f_09(x: int, y: int):...
def f_10(x: int, y: int):...
def f_11(x: int, y: int):...
def f_12(x: int, y: int):...


def main():
    # List to be able to incorporate a function by positional order to each menu option
    functions_list = [
        (f_01, {"x": 1,"y": 10}),
        (f_02, {"x": 2,"y": 11}),
        (f_03, {"x": 3,"y": 12}),
        (f_04, {"x": 4,"y": 13}),
        (f_05, {"x": 5,"y": 14}),
        (f_06, {"x": 6, "y": 15}),
        (f_07, {"x": 7, "y": 16}),
        (f_08, {"x": 8, "y": 17}),
        (f_09, {"x": 9, "y": 18}),
        (f_10, {"x": 10, "y": 19}),
        (f_11, {"x": 11, "y": 20}),
        (f_12, {"x": 12, "y": 21}),
    ]

    # Adds all the functions to menu
    TEST_MENU.add_function_to_menu(functions_list)

    # Shows the first frame
    TEST_MENU.show_frame_menu()

    while True:
        # Catches the user input
        input_u = input("...")
        # Clean the terminal
        system("cls")
        # Checks if the input generates a valid action and executes it
        TEST_MENU.control_menu(input_u)
        # Shows the frame changed
        TEST_MENU.show_frame_menu()
        

if __name__ == "__main__":
    main()

📄 License

This project is licensed under the MIT License.

📬 Contact

For any inquiries, reach out to me via:

Metadata

Release files for ASCII-Menus 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ASCII-Menus 1.0.0
File Size Uploaded Provenance Actions
ascii_menus-1.0.0.tar.gz 12.2 kB Without provenance Details for ascii_menus-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ASCII-Menus 1.0.0
File Interpreter ABI Platform Actions
ascii_menus-1.0.0-py3-none-any.whl Python 3 none any Details for ascii_menus-1.0.0-py3-none-any.whl

Total release size: 21.3 kB

Release files / ascii_menus-1.0.0.tar.gz

Download URL ascii_menus-1.0.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
afc2ef2e79c8eb30b6d33adb97e78c421c967036e187a9104f2bd9c2b9e1aec2
BLAKE2b-256 checksum
How to use checksums
3ac57300f543f6e8c2ea8a889c697b0fd9dbbfb18139cae0e774c126b2a12b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / ascii_menus-1.0.0-py3-none-any.whl

Download URL ascii_menus-1.0.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
553d51ba107640adb73de5a78e76afd11b24002ec08bbd00b67e2e1730a9221f
BLAKE2b-256 checksum
How to use checksums
6def229d98e4a7eea8fb39c376794b89b13d31dd67e862dd84fea1b332f1b737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for ASCII-Menus 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page